mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 23:07:44 +00:00
qemuMonitorGetMemoryDeviceInfo: Assign hash table only on success
Signed-off-by: Tim Wiederhake <twiederh@redhat.com> Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
parent
78f47cba9b
commit
927c9969b9
@ -4214,6 +4214,7 @@ int
|
|||||||
qemuMonitorGetMemoryDeviceInfo(qemuMonitor *mon,
|
qemuMonitorGetMemoryDeviceInfo(qemuMonitor *mon,
|
||||||
GHashTable **info)
|
GHashTable **info)
|
||||||
{
|
{
|
||||||
|
GHashTable *hash;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
VIR_DEBUG("info=%p", info);
|
VIR_DEBUG("info=%p", info);
|
||||||
@ -4222,14 +4223,13 @@ qemuMonitorGetMemoryDeviceInfo(qemuMonitor *mon,
|
|||||||
|
|
||||||
QEMU_CHECK_MONITOR(mon);
|
QEMU_CHECK_MONITOR(mon);
|
||||||
|
|
||||||
if (!(*info = virHashNew(g_free)))
|
if (!(hash = virHashNew(g_free)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if ((ret = qemuMonitorJSONGetMemoryDeviceInfo(mon, *info)) < 0) {
|
if ((ret = qemuMonitorJSONGetMemoryDeviceInfo(mon, hash)) >= 0)
|
||||||
virHashFree(*info);
|
*info = g_steal_pointer(&hash);
|
||||||
*info = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
virHashFree(hash);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user