mirror of https://gitee.com/openkylin/libvirt.git
qemuMonitorAddObject: Use g_clear_pointer for a free and reset operation
Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
b2899f0708
commit
377c3dd3b1
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue