[Crosstoolchain-logs] [device-tree-compiler] 190/198: fdtput.c: Fix memory leak.

Hector Oron zumbi at moszumanska.debian.org
Thu Dec 8 17:07:08 UTC 2016


This is an automated email from the git hooks/post-receive script.

zumbi pushed a commit to branch upstream/1.4.x
in repository device-tree-compiler.

commit c539075ba8ba61fffbf7e005ce2e834868a9e0ab
Author: Jean-Christophe Dubois <jcd at tribudubois.net>
Date:   Wed Jul 13 00:36:21 2016 +0200

    fdtput.c: Fix memory leak.
    
    CID 132821 (#1 of 1): Resource leak (RESOURCE_LEAK)
    12. leaked_storage: Variable value going out of scope leaks the storage it points to.
    
    Signed-off-by: Jean-Christophe Dubois <jcd at tribudubois.net>
    Signed-off-by: David Gibson <david at gibson.dropbear.id.au>
---
 fdtput.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fdtput.c b/fdtput.c
index 9b15c53..db65e96 100644
--- a/fdtput.c
+++ b/fdtput.c
@@ -328,7 +328,7 @@ static int delete_node(char *blob, const char *node_name)
 static int do_fdtput(struct display_info *disp, const char *filename,
 		    char **arg, int arg_count)
 {
-	char *value;
+	char *value = NULL;
 	char *blob;
 	char *node;
 	int len, ret = 0;
@@ -374,6 +374,11 @@ static int do_fdtput(struct display_info *disp, const char *filename,
 	}
 
 	free(blob);
+
+	if (value) {
+		free(value);
+	}
+
 	return ret;
 }
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/crosstoolchain/device-tree-compiler.git



More information about the Crosstoolchain-logs mailing list