mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-19 09:13:04 +00:00
command line: fix minor leaks.
* src/getargs.c (getargs): Free pointers before allocating them new content.
This commit is contained in:
@@ -606,13 +606,19 @@ getargs (int argc, char *argv[])
|
|||||||
/* Here, the -d and --defines options are differentiated. */
|
/* Here, the -d and --defines options are differentiated. */
|
||||||
defines_flag = true;
|
defines_flag = true;
|
||||||
if (optarg)
|
if (optarg)
|
||||||
spec_defines_file = xstrdup (AS_FILE_NAME (optarg));
|
{
|
||||||
|
free (spec_defines_file);
|
||||||
|
spec_defines_file = xstrdup (AS_FILE_NAME (optarg));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'g':
|
case 'g':
|
||||||
graph_flag = true;
|
graph_flag = true;
|
||||||
if (optarg)
|
if (optarg)
|
||||||
spec_graph_file = xstrdup (AS_FILE_NAME (optarg));
|
{
|
||||||
|
free (spec_graph_file);
|
||||||
|
spec_graph_file = xstrdup (AS_FILE_NAME (optarg));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
@@ -649,7 +655,10 @@ getargs (int argc, char *argv[])
|
|||||||
case 'x':
|
case 'x':
|
||||||
xml_flag = true;
|
xml_flag = true;
|
||||||
if (optarg)
|
if (optarg)
|
||||||
spec_xml_file = xstrdup (AS_FILE_NAME (optarg));
|
{
|
||||||
|
free (spec_xml_file);
|
||||||
|
spec_xml_file = xstrdup (AS_FILE_NAME (optarg));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'y':
|
case 'y':
|
||||||
@@ -669,6 +678,7 @@ getargs (int argc, char *argv[])
|
|||||||
exit (EXIT_SUCCESS);
|
exit (EXIT_SUCCESS);
|
||||||
|
|
||||||
case REPORT_FILE_OPTION:
|
case REPORT_FILE_OPTION:
|
||||||
|
free (spec_verbose_file);
|
||||||
spec_verbose_file = xstrdup (AS_FILE_NAME (optarg));
|
spec_verbose_file = xstrdup (AS_FILE_NAME (optarg));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user