[Crash-utility] [PATCH 2/2] Fix for memory leaks

Wei,Jiangang weijg.fnst at cn.fujitsu.com
Mon Apr 27 04:49:40 UTC 2015


Without this patch, the storage reserved with the call
to strdup won't be freed.

Signed-off-by: Wei,Jiangang <weijg.fnst at cn.fujitsu.com>
---
 configure.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/configure.c b/configure.c
index 77ac81d..f78ad61 100755
--- a/configure.c
+++ b/configure.c
@@ -704,6 +704,10 @@ build_configure(struct supported_gdb_version *sp)
 
 	}
 
+	free(ldflags);
+	free(cflags);
+	free(gdb_conf_flags);
+
 	makefile_create(&fp1, &fp2);
 	show_configuration();
 	make_build_data(&target[strlen("TARGET=")]);
@@ -1644,6 +1648,9 @@ add_extra_lib(char *option)
 			add_lsnappy++;
 	}
 
+	free(ldflags);
+	free(cflags);
+
 	if ((lzo || snappy) &&
 	    file_exists("diskdump.o") && (unlink("diskdump.o") < 0)) {
 		perror("diskdump.o");
-- 
1.9.3




More information about the Crash-utility mailing list