5b3492f qemu: cleanup error checking on agent replies

Authored and Committed by mkletzan 10 years ago
    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>
    
        
file modified
+7 -20