Patchwork [1/2] target-openrisc: Free typename in cpu_class_by_name

login
register
mail settings
Submitter Jia Liu
Date July 15, 2013, 9:09 a.m.
Message ID <1373879359-12803-2-git-send-email-proljc@gmail.com>
Download mbox | patch
Permalink /patch/258964/
State New
Headers show

Comments

Jia Liu - July 15, 2013, 9:09 a.m.
Add a g_free into openrisc_cpu_class_by_name to free typename.

Signed-off-by: Jia Liu <proljc@gmail.com>
---
 target-openrisc/cpu.c | 1 +
 1 file changed, 1 insertion(+)

Patch

diff --git a/target-openrisc/cpu.c b/target-openrisc/cpu.c
index 6d40f1b..e348df0 100644
--- a/target-openrisc/cpu.c
+++ b/target-openrisc/cpu.c
@@ -99,6 +99,7 @@  static ObjectClass *openrisc_cpu_class_by_name(const char *cpu_model)
 
     typename = g_strdup_printf("%s-" TYPE_OPENRISC_CPU, cpu_model);
     oc = object_class_by_name(typename);
+    g_free(typename);
     if (oc != NULL && (!object_class_dynamic_cast(oc, TYPE_OPENRISC_CPU) ||
                        object_class_is_abstract(oc))) {
         return NULL;