[libvirt] [PATCH 13/23] Fix leak of parser state in virJSONValueFromString

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


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

If OOM or another error occurs in virJSONValueFromString the
parser state object will be leaked.

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

diff --git a/src/util/virjson.c b/src/util/virjson.c
index 8918bc7..2bb7324 100644
--- a/src/util/virjson.c
+++ b/src/util/virjson.c
@@ -1014,6 +1014,7 @@ cleanup:
         for (i = 0; i < parser.nstate; i++) {
             VIR_FREE(parser.state[i].key);
         }
+        VIR_FREE(parser.state);
     }
 
     VIR_DEBUG("result=%p", parser.head);
-- 
1.8.3.1




More information about the libvir-list mailing list