From: Markus Armbruster Date: Fri, 2 May 2014 11:26:34 +0000 (+0200) Subject: hmp: Guard against misuse of hmp_handle_error() X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=415168e0c7bda5371a876914d4fdb68c4556f28d;p=qemu.git hmp: Guard against misuse of hmp_handle_error() 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 Reviewed-by: Eric Blake Signed-off-by: Luiz Capitulino --- diff --git a/hmp.c b/hmp.c index 9469163913..5c4d612294 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); }