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

Paul Menzel (paulepanter@users.sourceforge.net) gerrit at coreboot.org
Mon Aug 4 08:27:00 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/6487

-gerrit

commit f9061cf60cf79c156aa713d3325529688ae2f7b0
Author: Paul Menzel <paulepanter at users.sourceforge.net>
Date:   Mon Aug 4 08:22:39 2014 +0200

    util/sconfig/main.c: Free memory pointed to by `outputc`
    
    Cppcheck 1.65 reports the error below.
    
    	[main.c:709]: (error) Memory leak: outputc
    
    So free the memory space pointed to by `outputc` to fix the memory
    leak.
    
    Change-Id: I1767cd15380832a93cc79fb515861982e3f1ee94
    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 6295e01..90ceda2 100644
--- a/util/sconfig/main.c
+++ b/util/sconfig/main.c
@@ -629,9 +629,11 @@ int main(int argc, char** argv) {
 	FILE *autogen = fopen(outputc, "w");
 	if (!autogen) {
 		fprintf(stderr, "Could not open file '%s' for writing: ", outputc);
+		free(outputc);
 		perror(NULL);
 		exit(1);
 	}
+	free(outputc);
 
 	struct header *h;
 	if (scan_mode == STATIC_MODE) {



More information about the coreboot-gerrit mailing list