diff mbox

[v2,07/15] hmp: Guard against misuse of hmp_handle_error()

Message ID 1398716874-18699-8-git-send-email-armbru@redhat.com
State New
Headers show

Commit Message

Markus Armbruster April 28, 2014, 8:27 p.m. UTC
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>
---
 hmp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox

Patch

diff --git a/hmp.c b/hmp.c
index eb8ff41..ad31ceb 100644
--- 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);
     }