mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-22 20:45:18 +00:00
qemuMonitorJSONGetObjectProps: Refactor cleanup
Use 'g_autoptr' for the two temporary JSON objects and remove the cleanup section. Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
b408580960
commit
d0f60b89f3
@ -6709,9 +6709,8 @@ qemuMonitorJSONGetObjectProps(qemuMonitor *mon,
|
||||
const char *object,
|
||||
char ***props)
|
||||
{
|
||||
int ret = -1;
|
||||
virJSONValue *cmd;
|
||||
virJSONValue *reply = NULL;
|
||||
g_autoptr(virJSONValue) cmd = NULL;
|
||||
g_autoptr(virJSONValue) reply = NULL;
|
||||
|
||||
*props = NULL;
|
||||
|
||||
@ -6721,18 +6720,12 @@ qemuMonitorJSONGetObjectProps(qemuMonitor *mon,
|
||||
return -1;
|
||||
|
||||
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
|
||||
goto cleanup;
|
||||
return -1;
|
||||
|
||||
if (qemuMonitorJSONHasError(reply, "DeviceNotFound")) {
|
||||
ret = 0;
|
||||
goto cleanup;
|
||||
}
|
||||
if (qemuMonitorJSONHasError(reply, "DeviceNotFound"))
|
||||
return 0;
|
||||
|
||||
ret = qemuMonitorJSONParsePropsList(cmd, reply, NULL, props);
|
||||
cleanup:
|
||||
virJSONValueFree(reply);
|
||||
virJSONValueFree(cmd);
|
||||
return ret;
|
||||
return qemuMonitorJSONParsePropsList(cmd, reply, NULL, props);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user