Skip to contentSkip to conversation

target-sparc: Replace free by g_free

PATCH Applied Stefan Weil 3 participants 3 messages Jun 10, 2013 – Jun 11, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target-sparc: Replace free by g_free

The wrong function was reported by cppcheck.

---
 target-sparc/cpu.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target-sparc/cpu.c +1 -1
index 290b580..13bb7bb 100644
@@ -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;
 }
 
Signature · 1 line
1.7.10.4
#1 lore raw

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

Reviewed-by on v1 1/1
#2 lore raw
In reply to Stefan Weil

Am 10.06.2013 22:40, schrieb Stefan Weil:

Quoted 3 lines

The wrong function was reported by cppcheck.

Quoted 9 lines
---
 target-sparc/cpu.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
target-sparc/cpu.c +0 -0
index 290b580..13bb7bb 100644

target-sparc/cpu.c static int cpu_sparc_find_by_name(sparc_def_t *cpu_def, const char *cpu_model) · line 620

Quoted 8 lines
target-sparc/cpu.c +1 -1
@@ -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

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg