Patchwork [01/10] device_tree: Fix potential memory leak

login
register
mail settings
Submitter Stefan Hajnoczi
Date Oct. 26, 2011, 2:22 p.m.
Message ID <1319638933-19063-2-git-send-email-stefanha@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/121933/
State New
Headers show

Comments

Stefan Hajnoczi - Oct. 26, 2011, 2:22 p.m.
From: Stefan Weil <sw@weilnetz.de>

cppcheck error report:

device_tree.c:156: error: Memory leak: dupname

Signed-off-by: Stefan Weil <sw@weilnetz.de>
Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
---
 device_tree.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

Patch

diff --git a/device_tree.c b/device_tree.c
index dc69232..86a694c 100644
--- a/device_tree.c
+++ b/device_tree.c
@@ -153,6 +153,7 @@  int qemu_devtree_add_subnode(void *fdt, const char *name)
     int retval;
 
     if (!basename) {
+        g_free(dupname);
         return -1;
     }