提交 a592d589 编写于 作者: P Peter Krempa

qemuMonitorJSONBlockdevDel: Refactor cleanup

Use automatic variable freeing and get rid of the cleanup section.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NJán Tomko <jtomko@redhat.com>
Reviewed-by: NDaniel Henrique Barboza <danielhb413@gmail.com>
上级 64329411
......@@ -8843,9 +8843,8 @@ int
qemuMonitorJSONBlockdevDel(qemuMonitorPtr mon,
const char *nodename)
{
virJSONValuePtr cmd;
virJSONValuePtr reply = NULL;
int ret = -1;
g_autoptr(virJSONValue) cmd = NULL;
g_autoptr(virJSONValue) reply = NULL;
if (!(cmd = qemuMonitorJSONMakeCommand("blockdev-del",
"s:node-name", nodename,
......@@ -8853,17 +8852,12 @@ qemuMonitorJSONBlockdevDel(qemuMonitorPtr mon,
return -1;
if (qemuMonitorJSONCommand(mon, cmd, &reply) < 0)
goto cleanup;
return -1;
if (qemuMonitorJSONCheckError(cmd, reply) < 0)
goto cleanup;
ret = 0;
return -1;
cleanup:
virJSONValueFree(cmd);
virJSONValueFree(reply);
return ret;
return 0;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册