[coreboot-gerrit] New patch to review for coreboot: 0162234 util/sconfig/main.c: Free memory pointed to by `devtree`

Paul Menzel (paulepanter@users.sourceforge.net) gerrit at coreboot.org
Mon Aug 4 08:26:59 CEST 2014


Paul Menzel (paulepanter at users.sourceforge.net) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/6486

-gerrit

commit 0162234401f52cc13c5cf2edf501047b45977e83
Author: Paul Menzel <paulepanter at users.sourceforge.net>
Date:   Mon Aug 4 08:15:03 2014 +0200

    util/sconfig/main.c: Free memory pointed to by `devtree`
    
    Cppcheck 1.65 reports the error below.
    
    	[main.c:709]: (error) Memory leak: devtree
    
    So free the memory space pointed to by `devtree` to fix the memory
    leak.
    
    Change-Id: Ibcd93057e88544ea900d9b6261c907baa751b2f1
    Signed-off-by: Paul Menzel <paulepanter at users.sourceforge.net>
---
 util/sconfig/main.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/util/sconfig/main.c b/util/sconfig/main.c
index 44d4911..6295e01 100644
--- a/util/sconfig/main.c
+++ b/util/sconfig/main.c
@@ -606,9 +606,11 @@ int main(int argc, char** argv) {
 	FILE *filec = fopen(devtree, "r");
 	if (!filec) {
 		fprintf(stderr, "Could not open file '%s' for reading: ", devtree);
+		free(devtree);
 		perror(NULL);
 		exit(1);
 	}
+	free(devtree);
 
 	yyrestart(filec);
 



More information about the coreboot-gerrit mailing list