Installed in maint.
From 0b7fba1335c0c3fde1eab89e265cbcecf20885a8 Mon Sep 17 00:00:00 2001
From: Akim Demaille <[email protected]>
Date: Tue, 8 May 2012 10:27:34 +0200
Subject: [PATCH 2/2] command line: fix minor leaks.
* src/getargs.c (getargs): Free pointers before allocating them new
content.
---
src/getargs.c | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
diff --git a/src/getargs.c b/src/getargs.c
index 1185e40..3fa2a7a 100644
--- a/src/getargs.c
+++ b/src/getargs.c
@@ -606,13 +606,19 @@ getargs (int argc, char *argv[])
/* Here, the -d and --defines options are differentiated. */
defines_flag = true;
if (optarg)
- spec_defines_file = xstrdup (AS_FILE_NAME (optarg));
+ {
+ free (spec_defines_file);
+ spec_defines_file = xstrdup (AS_FILE_NAME (optarg));
+ }
break;
case 'g':
graph_flag = true;
if (optarg)
- spec_graph_file = xstrdup (AS_FILE_NAME (optarg));
+ {
+ free (spec_graph_file);
+ spec_graph_file = xstrdup (AS_FILE_NAME (optarg));
+ }
break;
case 'h':
@@ -649,7 +655,10 @@ getargs (int argc, char *argv[])
case 'x':
xml_flag = true;
if (optarg)
- spec_xml_file = xstrdup (AS_FILE_NAME (optarg));
+ {
+ free (spec_xml_file);
+ spec_xml_file = xstrdup (AS_FILE_NAME (optarg));
+ }
break;
case 'y':
@@ -669,6 +678,7 @@ getargs (int argc, char *argv[])
exit (EXIT_SUCCESS);
case REPORT_FILE_OPTION:
+ free (spec_verbose_file);
spec_verbose_file = xstrdup (AS_FILE_NAME (optarg));
break;
--
1.7.10.1