summaryrefslogtreecommitdiff
path: root/ld/lexsup.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2003-03-31 18:13:25 +0000
committerNick Clifton <nickc@redhat.com>2003-03-31 18:13:25 +0000
commit5ed6aba41c826194dcc97807392b22a3cefa1d7e (patch)
tree8e87d13436f477ba70e90e9109c69dcaf3d18e27 /ld/lexsup.c
parentee42cf8cc569b0ad926df63483075ccd868a10fa (diff)
downloadbinutils-5ed6aba41c826194dcc97807392b22a3cefa1d7e.tar.gz
binutils-5ed6aba41c826194dcc97807392b22a3cefa1d7e.tar.bz2
binutils-5ed6aba41c826194dcc97807392b22a3cefa1d7e.zip
Fix memory leaks
Diffstat (limited to 'ld/lexsup.c')
-rw-r--r--ld/lexsup.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/ld/lexsup.c b/ld/lexsup.c
index b6c2fd87ace..e8c2eba7b93 100644
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -1116,6 +1116,8 @@ parse_args (argc, argv)
case 'Y':
if (strncmp (optarg, "P,", 2) == 0)
optarg += 2;
+ if (default_dirlist != NULL)
+ free (default_dirlist);
default_dirlist = xstrdup (optarg);
break;
case 'y':
@@ -1193,8 +1195,10 @@ parse_args (argc, argv)
lang_leave_group ();
if (default_dirlist != NULL)
- set_default_dirlist (default_dirlist);
-
+ {
+ set_default_dirlist (default_dirlist);
+ free (default_dirlist);
+ }
}
/* Add the (colon-separated) elements of DIRLIST_PTR to the