From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:53234) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WiTPE-0005Ya-Aj for qemu-devel@nongnu.org; Thu, 08 May 2014 14:51:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WiTP9-0007hR-Hd for qemu-devel@nongnu.org; Thu, 08 May 2014 14:50:56 -0400 Date: Thu, 8 May 2014 14:21:13 -0400 From: Luiz Capitulino Message-ID: <20140508142113.7cd1cf15@redhat.com> In-Reply-To: <1399564995-23956-1-git-send-email-pl@kamp.de> References: <1399564995-23956-1-git-send-email-pl@kamp.de> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] Revert "qapi: Clean up superfluous null check in qapi_dealloc_type_str()" List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Lieven Cc: mdroth@linux.vnet.ibm.com, qemu-devel@nongnu.org, armbru@redhat.com, qemu-stable@nongnu.org, pbonzini@redhat.com On Thu, 8 May 2014 18:03:15 +0200 Peter Lieven wrote: > This reverts commit 25a7017555f1b4aeb543b5d323ff4afb8f9c5437. > > Turns out the argument *can* be null: QEMU now segfaults if it > receives an invalid parameter via a qmp command instead of throwing an > error. > > For example: > { "execute": "blockdev-add", > "arguments": { "options" : { "driver": "invalid-driver" } } } > > CC: qemu-stable@nongnu.org > Signed-off-by: Peter Lieven > Reviewed-by: Eric Blake > Reviewed-by: Markus Armbruster Applied to the qmp branch, thanks. > --- > qapi/qapi-dealloc-visitor.c | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/qapi/qapi-dealloc-visitor.c b/qapi/qapi-dealloc-visitor.c > index d0ea118..dc53545 100644 > --- a/qapi/qapi-dealloc-visitor.c > +++ b/qapi/qapi-dealloc-visitor.c > @@ -131,7 +131,9 @@ static void qapi_dealloc_end_list(Visitor *v, Error **errp) > static void qapi_dealloc_type_str(Visitor *v, char **obj, const char *name, > Error **errp) > { > - g_free(*obj); > + if (obj) { > + g_free(*obj); > + } > } > > static void qapi_dealloc_type_int(Visitor *v, int64_t *obj, const char *name,