summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Lieven <pl@kamp.de>2014-05-08 18:03:15 +0200
committerLuiz Capitulino <lcapitulino@redhat.com>2014-05-09 09:11:32 -0400
commitb690d679c1ca65d71b0544a2331d50e9f0f95116 (patch)
treefb328bf796d9b14b650517e8a42894f782228e39
parentcc1626556d264c867a07ebe8672fa06b208e209a (diff)
downloadhqemu-b690d679c1ca65d71b0544a2331d50e9f0f95116.zip
hqemu-b690d679c1ca65d71b0544a2331d50e9f0f95116.tar.gz
Revert "qapi: Clean up superfluous null check in qapi_dealloc_type_str()"
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 <pl@kamp.de> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Markus Armbruster <armbru@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
-rw-r--r--qapi/qapi-dealloc-visitor.c4
1 files changed, 3 insertions, 1 deletions
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,
OpenPOWER on IntegriCloud