Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/util/virjson.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/util/virjson.c b/src/util/virjson.c
index e4d71d3e09..7b52525797 100644
--- a/src/util/virjson.c
+++ b/src/util/virjson.c
@@ -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:
--
2.29.2