qemuMonitorGetPRManagerInfo: Use automatic memory management

Signed-off-by: Tim Wiederhake <twiederh@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
This commit is contained in:
Tim Wiederhake 2021-07-05 16:05:52 +02:00
parent df27180d49
commit cdcbdd25e1

View File

@ -4516,21 +4516,18 @@ qemuMonitorGetPRManagerInfo(qemuMonitor *mon,
GHashTable **retinfo) GHashTable **retinfo)
{ {
int ret = -1; int ret = -1;
GHashTable *info = NULL; g_autoptr(GHashTable) info = virHashNew(g_free);
*retinfo = NULL; *retinfo = NULL;
QEMU_CHECK_MONITOR(mon); QEMU_CHECK_MONITOR(mon);
info = virHashNew(g_free);
if (qemuMonitorJSONGetPRManagerInfo(mon, info) < 0) if (qemuMonitorJSONGetPRManagerInfo(mon, info) < 0)
goto cleanup; goto cleanup;
*retinfo = g_steal_pointer(&info); *retinfo = g_steal_pointer(&info);
ret = 0; ret = 0;
cleanup: cleanup:
virHashFree(info);
return ret; return ret;
} }