From 91141474f85b933764b3271a74027952ecd5ccf0 Mon Sep 17 00:00:00 2001 From: Osier Yang Date: Thu, 23 Jun 2011 18:16:31 +0800 Subject: [PATCH] util: Fix memory leak in virJSONParserHandleStartMap --- src/util/json.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/util/json.c b/src/util/json.c index db2727d848..48521f2ccb 100644 --- a/src/util/json.c +++ b/src/util/json.c @@ -799,8 +799,10 @@ static int virJSONParserHandleStartMap(void *ctx) } if (VIR_REALLOC_N(parser->state, - parser->nstate + 1) < 0) + parser->nstate + 1) < 0) { + virJSONValueFree(value); return 0; + } parser->state[parser->nstate].value = value; parser->state[parser->nstate].key = NULL;