From: Ján Tomko Date: Sat, 15 Jun 2019 09:58:32 +0000 (+0200) Subject: tests: qemuMonitorReportError: use tmp variable properly X-Git-Tag: v5.5.0-rc1~259 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fba29dff836d2e7e0fc2fea7010b7fda32b36f25;p=thirdparty%2Flibvirt.git tests: qemuMonitorReportError: use tmp variable properly There is no obvious benefit in putting the escaped message back into msg while tmp holds the original message. Remove the assignment and use 'tmp' directly'. Signed-off-by: Ján Tomko --- diff --git a/tests/qemumonitortestutils.c b/tests/qemumonitortestutils.c index bb30bed51e..7d336e1aa7 100644 --- a/tests/qemumonitortestutils.c +++ b/tests/qemumonitortestutils.c @@ -213,16 +213,14 @@ qemuMonitorReportError(qemuMonitorTestPtr test, const char *errmsg, ...) goto cleanup; if (test->agent || test->json) { - char *tmp = msg; - msg = qemuMonitorEscapeArg(tmp); - VIR_FREE(tmp); - if (!msg) + VIR_AUTOFREE(char *) tmp = NULL; + if (!(tmp = qemuMonitorEscapeArg(msg))) goto cleanup; if (virAsprintf(&jsonmsg, "{ \"error\": " " { \"desc\": \"%s\", " " \"class\": \"UnexpectedCommand\" } }", - msg) < 0) + tmp) < 0) goto cleanup; } else { if (virAsprintf(&jsonmsg, "error: '%s'", msg) < 0)