Signed-off-by: Peter Krempa <pkrempa(a)redhat.com>
---
src/qemu/qemu_monitor.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c
index d752b299ab..6beb23e9f7 100644
--- a/src/qemu/qemu_monitor.c
+++ b/src/qemu/qemu_monitor.c
@@ -2956,10 +2956,9 @@ qemuMonitorAddObject(qemuMonitor *mon,
ignore_value(virJSONValueObjectRemoveKey(*props, "qom-type",
&typeobj));
ignore_value(virJSONValueObjectRemoveKey(*props, "id", &idobj));
- if (!virJSONValueObjectGetKey(*props, 0)) {
- virJSONValueFree(*props);
- *props = NULL;
- }
+ /* avoid empty 'props' member */
+ if (!virJSONValueObjectGetKey(*props, 0))
+ g_clear_pointer(props, virJSONValueFree);
if (virJSONValueObjectAdd(&pr,
"s:qom-type", type,
--
2.31.1