summaryrefslogtreecommitdiff
path: root/binutils/windmc.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2008-01-09 10:40:32 +0000
committerNick Clifton <nickc@redhat.com>2008-01-09 10:40:32 +0000
commita0515286bfc5c10baebfd43550722623fb2aefdd (patch)
tree364414f673c2caf96370cb8b4055e29e3d30b7f6 /binutils/windmc.c
parentc5fc963df621a41e7e27f1d97462acd138bd6c42 (diff)
downloadbinutils-redhat-a0515286bfc5c10baebfd43550722623fb2aefdd.tar.gz
PR binutils/55326
* bucomm.c (list_supported_architectures): Free architecture list after use. * windres.c (set_endianess): Likewise. * windmc.c (set_endianess): Likewise.
Diffstat (limited to 'binutils/windmc.c')
-rw-r--r--binutils/windmc.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/binutils/windmc.c b/binutils/windmc.c
index 14a2f86a1d..2c6da4283d 100644
--- a/binutils/windmc.c
+++ b/binutils/windmc.c
@@ -245,18 +245,23 @@ set_endianess (bfd *abfd, const char *target)
if (! target_vec)
fatal ("Can't detect target endianess and architecture.");
target_is_bigendian = ((target_vec->byteorder == BFD_ENDIAN_BIG) ? 1 : 0);
+
{
- const char *tname = target_vec->name;
- const char **arch = bfd_arch_list ();
+ const char * tname = target_vec->name;
+ const char ** arches = bfd_arch_list ();
- if (arch && tname)
+ if (arches && tname)
{
+ const char ** arch = arches;
+
if (strchr (tname, '-') != NULL)
tname = strchr (tname, '-') + 1;
+
while (*arch != NULL)
{
const char *in_a = strstr (*arch, tname);
char end_ch = (in_a ? in_a[strlen (tname)] : 0);
+
if (in_a && (in_a == *arch || in_a[-1] == ':')
&& end_ch == 0)
{
@@ -266,6 +271,9 @@ set_endianess (bfd *abfd, const char *target)
arch++;
}
}
+
+ free (arches);
+
if (! def_target_arch)
fatal ("Can't detect architecture.");
}