diff --git a/src/util/json.c b/src/util/json.c index db2727d848f6c06a706a32c1e9a41efbda5ff5c3..48521f2ccb2c3e1803b62165139c216bed352103 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;