]> git.proxmox.com Git - mirror_qemu.git/commitdiff
hmp: Guard against misuse of hmp_handle_error()
authorMarkus Armbruster <armbru@redhat.com>
Fri, 2 May 2014 11:26:34 +0000 (13:26 +0200)
committerLuiz Capitulino <lcapitulino@redhat.com>
Fri, 9 May 2014 13:11:31 +0000 (09:11 -0400)
Null errp argument makes no sense.  Assert it's not null, to make this
explicit, and guard against misuse.  All current callers pass non-null
errp.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
hmp.c

diff --git a/hmp.c b/hmp.c
index 9469163913fcf2005feeb33b0dc32548214dad1f..5c4d6122944e0762709fc69207032914772e8017 100644 (file)
--- a/hmp.c
+++ b/hmp.c
@@ -28,7 +28,8 @@
 
 static void hmp_handle_error(Monitor *mon, Error **errp)
 {
-    if (error_is_set(errp)) {
+    assert(errp);
+    if (*errp) {
         monitor_printf(mon, "%s\n", error_get_pretty(*errp));
         error_free(*errp);
     }