qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Revert "qapi: Clean up superfluous null check in qapi_dealloc_type_str()"
@ 2014-05-08 16:03 Peter Lieven
  2014-05-08 18:21 ` Luiz Capitulino
  0 siblings, 1 reply; 2+ messages in thread
From: Peter Lieven @ 2014-05-08 16:03 UTC (permalink / raw)
  To: qemu-devel
  Cc: qemu-stable, Peter Lieven, armbru, mdroth, pbonzini, lcapitulino

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>
---
 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,
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] Revert "qapi: Clean up superfluous null check in qapi_dealloc_type_str()"
  2014-05-08 16:03 [Qemu-devel] [PATCH] Revert "qapi: Clean up superfluous null check in qapi_dealloc_type_str()" Peter Lieven
@ 2014-05-08 18:21 ` Luiz Capitulino
  0 siblings, 0 replies; 2+ messages in thread
From: Luiz Capitulino @ 2014-05-08 18:21 UTC (permalink / raw)
  To: Peter Lieven; +Cc: mdroth, qemu-devel, armbru, qemu-stable, pbonzini

On Thu,  8 May 2014 18:03:15 +0200
Peter Lieven <pl@kamp.de> 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 <pl@kamp.de>
> Reviewed-by: Eric Blake <eblake@redhat.com>
> Reviewed-by: Markus Armbruster <armbru@redhat.com>

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,

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-05-08 18:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-08 16:03 [Qemu-devel] [PATCH] Revert "qapi: Clean up superfluous null check in qapi_dealloc_type_str()" Peter Lieven
2014-05-08 18:21 ` Luiz Capitulino

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).