diff mbox

target-sparc: Replace free by g_free

Message ID 1370896852-12473-1-git-send-email-sw@weilnetz.de
State Accepted
Headers show

Commit Message

Stefan Weil June 10, 2013, 8:40 p.m. UTC
The wrong function was reported by cppcheck.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
---
 target-sparc/cpu.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Michael Tokarev June 11, 2013, 12:13 p.m. UTC | #1
Thanks, applied all 4(*) to trivial-patches queue.

(*)
 target-sparc: Replace free by g_free
 hw/scsi: Don't increment a boolean value
 device tree: Fix cppcheck warning
 hw/xen: Use g_free instead of free and fix potential memory leaks

(I think it wont hurt if the xen one will come from both -trivial
and xen trees, first one wins ;)

/mjt
Andreas Färber June 11, 2013, 12:27 p.m. UTC | #2
Am 10.06.2013 22:40, schrieb Stefan Weil:
> The wrong function was reported by cppcheck.
> 
> Signed-off-by: Stefan Weil <sw@weilnetz.de>

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

> ---
>  target-sparc/cpu.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/target-sparc/cpu.c b/target-sparc/cpu.c
> index 290b580..13bb7bb 100644
> --- a/target-sparc/cpu.c
> +++ b/target-sparc/cpu.c
> @@ -614,7 +614,7 @@ static int cpu_sparc_find_by_name(sparc_def_t *cpu_def, const char *cpu_model)
>      return 0;
>  
>   error:
> -    free(s);
> +    g_free(s);
>      return -1;
>  }
>  

So s is for the string, and matches occurrence above, fine.

Andreas
diff mbox

Patch

diff --git a/target-sparc/cpu.c b/target-sparc/cpu.c
index 290b580..13bb7bb 100644
--- a/target-sparc/cpu.c
+++ b/target-sparc/cpu.c
@@ -614,7 +614,7 @@  static int cpu_sparc_find_by_name(sparc_def_t *cpu_def, const char *cpu_model)
     return 0;
 
  error:
-    free(s);
+    g_free(s);
     return -1;
 }