Skip to content

Commit

Permalink
qga: fix assert regression on guest-shutdown
Browse files Browse the repository at this point in the history
Since commit 781f2b3 ("qga: process_event() simplification"),
send_response() is called unconditionally, but will assert when "rsp" is
NULL. This may happen with QCO_NO_SUCCESS_RESP commands, such as
"guest-shutdown".

Fixes: 781f2b3
Cc: Michael Roth <mdroth@linux.vnet.ibm.com>
Reported-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Reviewed-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Tested-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
  • Loading branch information
elmarco authored and mdroth committed Jul 13, 2020
1 parent 917ebcb commit 844bd70
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion qga/main.c
Expand Up @@ -531,7 +531,11 @@ static int send_response(GAState *s, const QDict *rsp)
QString *payload_qstr, *response_qstr;
GIOStatus status;

g_assert(rsp && s->channel);
g_assert(s->channel);

if (!rsp) {
return 0;
}

payload_qstr = qobject_to_json(QOBJECT(rsp));
if (!payload_qstr) {
Expand Down

0 comments on commit 844bd70

Please sign in to comment.