virJSONValueObjectAddVArgs: Use autofree for the temporary bitmap

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 10:56:49 +01:00
parent 94ab321ffc
commit e4b26c48cb

View File

@ -305,7 +305,7 @@ virJSONValueObjectAddVArgs(virJSONValuePtr obj,
case 'M':
case 'm': {
virBitmapPtr map = va_arg(args, virBitmapPtr);
virJSONValuePtr jsonMap;
g_autoptr(virJSONValue) jsonMap = NULL;
if (!map) {
if (type == 'M')
@ -321,7 +321,8 @@ virJSONValueObjectAddVArgs(virJSONValuePtr obj,
return -1;
if ((rc = virJSONValueObjectAppend(obj, key, jsonMap)) < 0)
virJSONValueFree(jsonMap);
return -1;
jsonMap = NULL;
} break;
default: