aboutsummaryrefslogtreecommitdiff
path: root/binutils
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-11-09 09:39:53 +1030
committerAlan Modra <amodra@gmail.com>2020-11-09 14:20:10 +1030
commita4e91c46306ed0bd24b45f882af0e28c5c8c3634 (patch)
tree6de637599f10372db3db6caec0e625de394687c0 /binutils
parent904790e24f4a332d0eedf302e417d0f16625f12f (diff)
downloadgdb-a4e91c46306ed0bd24b45f882af0e28c5c8c3634.zip
gdb-a4e91c46306ed0bd24b45f882af0e28c5c8c3634.tar.gz
gdb-a4e91c46306ed0bd24b45f882af0e28c5c8c3634.tar.bz2
elfedit false "may be used uninitialised"
elfedit.c:904:15: error: 'osabi' may be used uninitialised in this function [-Werror=maybe-uninitialized] 904 | osabi = concat (osabi, "|", osabis[i].name, NULL); | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * elfedit (usage): Avoid false positive "may be used uninitialised". Don't leak memory.
Diffstat (limited to 'binutils')
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/elfedit.c9
2 files changed, 8 insertions, 6 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 2e24faf..49e1f05 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
+2020-11-09 Alan Modra <amodra@gmail.com>
+
+ * elfedit (usage): Avoid false positive "may be used uninitialised".
+ Don't leak memory.
+
2020-11-09 Howard Chu <hyc@symas.com>
* ar.c (main): Use plugin_target rather than "target" when
diff --git a/binutils/elfedit.c b/binutils/elfedit.c
index 5fffe84..55474ff 100644
--- a/binutils/elfedit.c
+++ b/binutils/elfedit.c
@@ -895,13 +895,10 @@ ATTRIBUTE_NORETURN static void
usage (FILE *stream, int exit_status)
{
unsigned int i;
- char *osabi;
+ char *osabi = concat (osabis[0].name, NULL);
- for (i = 0; i < ARRAY_SIZE (osabis); i++)
- if (i == 0)
- osabi = concat (osabis[i].name, NULL);
- else
- osabi = concat (osabi, "|", osabis[i].name, NULL);
+ for (i = 1; i < ARRAY_SIZE (osabis); i++)
+ osabi = reconcat (osabi, "|", osabis[i].name, NULL);
fprintf (stream, _("Usage: %s <option(s)> elffile(s)\n"),
program_name);