testQEMUSchemaValidateObjectMergeVariantMember: Fix theoretical leak

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Peter Krempa 2021-02-12 11:36:30 +01:00
parent d4e369a4c3
commit 962d80e751

View File

@ -163,13 +163,14 @@ testQEMUSchemaValidateObjectMergeVariantMember(size_t pos G_GNUC_UNUSED,
void *opaque)
{
virJSONValuePtr array = opaque;
virJSONValuePtr copy;
g_autoptr(virJSONValue) copy = NULL;
if (!(copy = virJSONValueCopy(item)))
return -1;
if (virJSONValueArrayAppend(array, copy) < 0)
return -1;
copy = NULL;
return 1;
}