]> git.ipfire.org Git - thirdparty/libvirt.git/commit
qemu: cleanup error checking on agent replies
authorMartin Kletzander <mkletzan@redhat.com>
Tue, 1 Apr 2014 12:58:56 +0000 (14:58 +0200)
committerMartin Kletzander <mkletzan@redhat.com>
Wed, 9 Apr 2014 16:30:05 +0000 (18:30 +0200)
commit74cf8368b6cd8e0bb6d69df68dd6fd467caef68c
tree4b6701d8d7c1268c0c994b8d11c0c87159323d2d
parent5423caa948c657e293f629a01bc6c3e79c6708a8
qemu: cleanup error checking on agent replies

On all the places where qemuAgentComand() was called, we did a check
for errors in the reply.  Unfortunately, some of the places called
qemuAgentCheckError() without checking for non-null reply which might
have resulted in a crash.

So this patch makes the error-checking part of qemuAgentCommand()
itself, which:

 a) makes it look better,

 b) makes the check mandatory and, most importantly,

 c) checks for the errors if and only if it is appropriate.

This actually fixes a potential crashers when qemuAgentComand()
returned 0, but reply was NULL.  Having said that, it *should* fix the
following bug:

https://bugzilla.redhat.com/show_bug.cgi?id=1058149

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 5b3492fadb6bfddd370e263bf8a6953b1b26116f)
src/qemu/qemu_agent.c