[libvirt] [PATCH 12/23] Fix double-free in virJSONParserHandleStartMap on OOM

Daniel P. Berrange berrange at redhat.com
Wed Sep 25 14:51:07 UTC 2013


From: "Daniel P. Berrange" <berrange at redhat.com>

If OOM occurs in virJSONParserHandleStartMap it will free
a variable that is owned by another object. This leads to
a later double-free.

Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---
 src/util/virjson.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/src/util/virjson.c b/src/util/virjson.c
index e93def7..8918bc7 100644
--- a/src/util/virjson.c
+++ b/src/util/virjson.c
@@ -862,7 +862,6 @@ static int virJSONParserHandleStartMap(void *ctx)
 
     if (VIR_REALLOC_N(parser->state,
                       parser->nstate + 1) < 0) {
-        virJSONValueFree(value);
         return 0;
     }
 
-- 
1.8.3.1




More information about the libvir-list mailing list