mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 14:57:42 +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,
|
||||
GHashTable **info)
|
||||
{
|
||||
GHashTable *hash;
|
||||
int ret;
|
||||
|
||||
VIR_DEBUG("info=%p", info);
|
||||
@ -4222,14 +4223,13 @@ qemuMonitorGetMemoryDeviceInfo(qemuMonitor *mon,
|
||||
|
||||
QEMU_CHECK_MONITOR(mon);
|
||||
|
||||
if (!(*info = virHashNew(g_free)))
|
||||
if (!(hash = virHashNew(g_free)))
|
||||
return -1;
|
||||
|
||||
if ((ret = qemuMonitorJSONGetMemoryDeviceInfo(mon, *info)) < 0) {
|
||||
virHashFree(*info);
|
||||
*info = NULL;
|
||||
}
|
||||
if ((ret = qemuMonitorJSONGetMemoryDeviceInfo(mon, hash)) >= 0)
|
||||
*info = g_steal_pointer(&hash);
|
||||
|
||||
virHashFree(hash);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user