Received: from eggs.gnu.org ([2001:4830:134:3::10]:54372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiTRt-0008Ob-6N for qemu-devel@nongnu.org; Thu, 08 May 2014 14:53:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WiTRl-0008UU-Q8 for qemu-devel@nongnu.org; Thu, 08 May 2014 14:53:41 -0400 Received: from mx1.redhat.com ([209.132.183.28]:40253) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiTRl-0008UJ-Ia for qemu-devel@nongnu.org; Thu, 08 May 2014 14:53:33 -0400 From: Luiz Capitulino Date: Thu, 8 May 2014 14:52:51 -0400 Message-Id: <1399575182-9768-28-git-send-email-lcapitulino@redhat.com> In-Reply-To: <1399575182-9768-1-git-send-email-lcapitulino@redhat.com> References: <1399575182-9768-1-git-send-email-lcapitulino@redhat.com> Subject: [Qemu-devel] [PULL 27/38] hmp: Guard against misuse of hmp_handle_error() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: peter.maydell@linaro.org Cc: qemu-devel@nongnu.org, anthony@codemonkey.ws From: Markus Armbruster 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 --- 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