diff options
author | Nick Clifton <nickc@redhat.com> | 2008-01-09 10:40:32 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2008-01-09 10:40:32 +0000 |
commit | d25576aadbe87e00dc7702b1d0a9c69c61d511d4 (patch) | |
tree | f0d0b5d746e46d0fad652bda2c174561ea64b8f1 /binutils/windmc.c | |
parent | 184d07da89afd7b64fedf2360e9412f3f221b5f8 (diff) | |
download | binutils-d25576aadbe87e00dc7702b1d0a9c69c61d511d4.zip binutils-d25576aadbe87e00dc7702b1d0a9c69c61d511d4.tar.gz binutils-d25576aadbe87e00dc7702b1d0a9c69c61d511d4.tar.bz2 |
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.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/binutils/windmc.c b/binutils/windmc.c index 14a2f86..2c6da42 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."); } |