You need to sign in or sign up before continuing.
提交 e4013f9f 编写于 作者: P Peter Krempa

tests: Refactor cleanup in qemuMonitorTestProcessCommandVerbatim

Use VIR_AUTOFREE and get rid of the cleanup section.
Signed-off-by: NPeter Krempa <pkrempa@redhat.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
上级 18006c69
...@@ -688,8 +688,8 @@ qemuMonitorTestProcessCommandVerbatim(qemuMonitorTestPtr test, ...@@ -688,8 +688,8 @@ qemuMonitorTestProcessCommandVerbatim(qemuMonitorTestPtr test,
const char *cmdstr) const char *cmdstr)
{ {
struct qemuMonitorTestHandlerData *data = item->opaque; struct qemuMonitorTestHandlerData *data = item->opaque;
char *reformatted = NULL; VIR_AUTOFREE(char *) reformatted = NULL;
char *errmsg = NULL; VIR_AUTOFREE(char *) errmsg = NULL;
int ret = -1; int ret = -1;
/* JSON strings will be reformatted to simplify checking */ /* JSON strings will be reformatted to simplify checking */
...@@ -705,7 +705,7 @@ qemuMonitorTestProcessCommandVerbatim(qemuMonitorTestPtr test, ...@@ -705,7 +705,7 @@ qemuMonitorTestProcessCommandVerbatim(qemuMonitorTestPtr test,
} else { } else {
if (data->cmderr) { if (data->cmderr) {
if (virAsprintf(&errmsg, "%s: %s", data->cmderr, cmdstr) < 0) if (virAsprintf(&errmsg, "%s: %s", data->cmderr, cmdstr) < 0)
goto cleanup; return -1;
ret = qemuMonitorTestAddErrorResponse(test, errmsg); ret = qemuMonitorTestAddErrorResponse(test, errmsg);
} else { } else {
...@@ -715,9 +715,6 @@ qemuMonitorTestProcessCommandVerbatim(qemuMonitorTestPtr test, ...@@ -715,9 +715,6 @@ qemuMonitorTestProcessCommandVerbatim(qemuMonitorTestPtr test,
} }
} }
cleanup:
VIR_FREE(errmsg);
VIR_FREE(reformatted);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册