qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL 27/38] hmp: Guard against misuse of hmp_handle_error(


From: Luiz Capitulino
Subject: [Qemu-devel] [PULL 27/38] hmp: Guard against misuse of hmp_handle_error()
Date: Thu, 8 May 2014 14:52:51 -0400

From: Markus Armbruster <address@hidden>

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 <address@hidden>
Reviewed-by: Eric Blake <address@hidden>
Signed-off-by: Luiz Capitulino <address@hidden>
---
 hmp.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hmp.c b/hmp.c
index 9469163..5c4d612 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);
     }
-- 
1.9.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]