[Crosstoolchain-logs] [device-tree-compiler] 189/198: fdtget.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 f79ddb83e18505b522700476e546591bae6a9d4f
Author: Jean-Christophe Dubois <jcd at tribudubois.net>
Date:   Wed Jul 13 00:36:08 2016 +0200

    fdtget.c: Fix memory leak
    
    CID 132823 (#1 of 1): Resource leak (RESOURCE_LEAK)
    5. leaked_storage: Variable blob 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>
---
 fdtget.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/fdtget.c b/fdtget.c
index 4377419..fb9d0e1 100644
--- a/fdtget.c
+++ b/fdtget.c
@@ -266,14 +266,20 @@ static int do_fdtget(struct display_info *disp, const char *filename,
 				continue;
 			} else {
 				report_error(arg[i], node);
+				free(blob);
 				return -1;
 			}
 		}
 		prop = args_per_step == 1 ? NULL : arg[i + 1];
 
-		if (show_data_for_item(blob, disp, node, prop))
+		if (show_data_for_item(blob, disp, node, prop)) {
+			free(blob);
 			return -1;
+		}
 	}
+
+	free(blob);
+
 	return 0;
 }
 

-- 
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