In the 'json_type_object' and/ro 'json_type_array' cases, the
error path uses 'g_free()', which doesn't release other nested
memory allocations. Replace it with 'virJSONValueFree()' to
properly free the entire 'virJSONValue' structure.
Fixes: 9e6555fd90988948a05e83466b1903bb95b36f39
Fixes: da66bf53b09ee8f5facacae700638a9a6f3a2477
Signed-off-by: Elizaveta Tereshkina <teryoshkina.ea@gmail.com>
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
virJSONValue *cur = virJSONValueFromJsonC(iter.val);
if (virJSONValueObjectAppend(ret, iter.key, &cur) < 0) {
- g_free(ret);
+ virJSONValueFree(ret);
return NULL;
}
}
cur = virJSONValueFromJsonC(val);
if (!cur) {
- g_free(ret);
+ virJSONValueFree(ret);
return NULL;
}