Patchwork [1/2] qdev: accept empty string properties

login
register
mail settings
Submitter Paolo Bonzini
Date Feb. 28, 2012, 8:54 a.m.
Message ID <1330419255-5566-2-git-send-email-pbonzini@redhat.com>
Download mbox | patch
Permalink /patch/143376/
State New
Headers show

Comments

Paolo Bonzini - Feb. 28, 2012, 8:54 a.m.
These were stored as NULL due to wrong cut-and-paste from set_pointer.

Reported-by: Gerhard Wiesinger <lists@wiesinger.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/qdev-properties.c |    4 ----
 1 files changed, 0 insertions(+), 4 deletions(-)
Gerhard Wiesinger - Feb. 28, 2012, 6:53 p.m.
Works well,

Tested-by: Gerhard Wiesinger <lists@wiesinger.com>

Ciao,
Gerhard

--
http://www.wiesinger.com/


On Tue, 28 Feb 2012, Paolo Bonzini wrote:

> These were stored as NULL due to wrong cut-and-paste from set_pointer.
>
> Reported-by: Gerhard Wiesinger <lists@wiesinger.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
> hw/qdev-properties.c |    4 ----
> 1 files changed, 0 insertions(+), 4 deletions(-)
>
> diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
> index 0423af1..bff9152 100644
> --- a/hw/qdev-properties.c
> +++ b/hw/qdev-properties.c
> @@ -421,10 +421,6 @@ static void set_string(Object *obj, Visitor *v, void *opaque,
>         error_propagate(errp, local_err);
>         return;
>     }
> -    if (!*str) {
> -        g_free(str);
> -        str = NULL;
> -    }
>     if (*ptr) {
>         g_free(*ptr);
>     }
> -- 
> 1.7.7.6
>
>
>
Andreas Färber - March 10, 2012, 1:14 p.m.
Am 28.02.2012 09:54, schrieb Paolo Bonzini:
> These were stored as NULL due to wrong cut-and-paste from set_pointer.
> 
> Reported-by: Gerhard Wiesinger <lists@wiesinger.com>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

Reviewed-by: Andreas Färber <afaerber@suse.de>

/-F

> ---
>  hw/qdev-properties.c |    4 ----
>  1 files changed, 0 insertions(+), 4 deletions(-)
> 
> diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
> index 0423af1..bff9152 100644
> --- a/hw/qdev-properties.c
> +++ b/hw/qdev-properties.c
> @@ -421,10 +421,6 @@ static void set_string(Object *obj, Visitor *v, void *opaque,
>          error_propagate(errp, local_err);
>          return;
>      }
> -    if (!*str) {
> -        g_free(str);
> -        str = NULL;
> -    }
>      if (*ptr) {
>          g_free(*ptr);
>      }

Patch

diff --git a/hw/qdev-properties.c b/hw/qdev-properties.c
index 0423af1..bff9152 100644
--- a/hw/qdev-properties.c
+++ b/hw/qdev-properties.c
@@ -421,10 +421,6 @@  static void set_string(Object *obj, Visitor *v, void *opaque,
         error_propagate(errp, local_err);
         return;
     }
-    if (!*str) {
-        g_free(str);
-        str = NULL;
-    }
     if (*ptr) {
         g_free(*ptr);
     }