In two instances we've created a string virJSONValue just to append it to the array. Replace it by use of the virJSONValueArrayAppendString helper. Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx> --- src/qemu/qemu_agent.c | 4 +--- src/util/virmacmap.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/qemu/qemu_agent.c b/src/qemu/qemu_agent.c index e2107e5cbf..cb3bf97415 100644 --- a/src/qemu/qemu_agent.c +++ b/src/qemu/qemu_agent.c @@ -1168,9 +1168,7 @@ qemuAgentMakeStringsArray(const char **strings, unsigned int len) g_autoptr(virJSONValue) ret = virJSONValueNewArray(); for (i = 0; i < len; i++) { - g_autoptr(virJSONValue) str = virJSONValueNewString(strings[i]); - - if (virJSONValueArrayAppend(ret, &str) < 0) + if (virJSONValueArrayAppendString(ret, strings[i]) < 0) return NULL; } diff --git a/src/util/virmacmap.c b/src/util/virmacmap.c index 0b7b758c6d..cf554205a8 100644 --- a/src/util/virmacmap.c +++ b/src/util/virmacmap.c @@ -214,9 +214,7 @@ virMACMapHashDumper(void *payload, GSList *next; for (next = macs; next; next = next->next) { - g_autoptr(virJSONValue) m = virJSONValueNewString((const char *) next->data); - - if (virJSONValueArrayAppend(arr, &m) < 0) + if (virJSONValueArrayAppendString(arr, (const char *) next->data) < 0) return -1; } -- 2.31.1