mirror of
https://github.com/libvirt/libvirt.git
synced 2025-02-25 18:55:26 -06:00
qemuAgentCheckError: use g_autofree
Signed-off-by: Peter Krempa <pkrempa@redhat.com> Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
parent
60527cbbc2
commit
f145df503e
@ -1055,8 +1055,8 @@ qemuAgentCheckError(virJSONValuePtr cmd,
|
|||||||
{
|
{
|
||||||
if (virJSONValueObjectHasKey(reply, "error")) {
|
if (virJSONValueObjectHasKey(reply, "error")) {
|
||||||
virJSONValuePtr error = virJSONValueObjectGet(reply, "error");
|
virJSONValuePtr error = virJSONValueObjectGet(reply, "error");
|
||||||
char *cmdstr = virJSONValueToString(cmd, false);
|
g_autofree char *cmdstr = virJSONValueToString(cmd, false);
|
||||||
char *replystr = virJSONValueToString(reply, false);
|
g_autofree char *replystr = virJSONValueToString(reply, false);
|
||||||
|
|
||||||
/* Log the full JSON formatted command & error */
|
/* Log the full JSON formatted command & error */
|
||||||
VIR_DEBUG("unable to execute QEMU agent command %s: %s",
|
VIR_DEBUG("unable to execute QEMU agent command %s: %s",
|
||||||
@ -1073,20 +1073,16 @@ qemuAgentCheckError(virJSONValuePtr cmd,
|
|||||||
qemuAgentCommandName(cmd),
|
qemuAgentCommandName(cmd),
|
||||||
qemuAgentStringifyError(error));
|
qemuAgentStringifyError(error));
|
||||||
|
|
||||||
VIR_FREE(cmdstr);
|
|
||||||
VIR_FREE(replystr);
|
|
||||||
return -1;
|
return -1;
|
||||||
} else if (!virJSONValueObjectHasKey(reply, "return")) {
|
} else if (!virJSONValueObjectHasKey(reply, "return")) {
|
||||||
char *cmdstr = virJSONValueToString(cmd, false);
|
g_autofree char *cmdstr = virJSONValueToString(cmd, false);
|
||||||
char *replystr = virJSONValueToString(reply, false);
|
g_autofree char *replystr = virJSONValueToString(reply, false);
|
||||||
|
|
||||||
VIR_DEBUG("Neither 'return' nor 'error' is set in the JSON reply %s: %s",
|
VIR_DEBUG("Neither 'return' nor 'error' is set in the JSON reply %s: %s",
|
||||||
NULLSTR(cmdstr), NULLSTR(replystr));
|
NULLSTR(cmdstr), NULLSTR(replystr));
|
||||||
virReportError(VIR_ERR_INTERNAL_ERROR,
|
virReportError(VIR_ERR_INTERNAL_ERROR,
|
||||||
_("unable to execute QEMU agent command '%s'"),
|
_("unable to execute QEMU agent command '%s'"),
|
||||||
qemuAgentCommandName(cmd));
|
qemuAgentCommandName(cmd));
|
||||||
VIR_FREE(cmdstr);
|
|
||||||
VIR_FREE(replystr);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user