Fix compile time warning about using a possibly uninitialised variable.
authorNick Clifton <nickc@redhat.com>
Tue, 3 Jan 2017 15:26:27 +0000 (15:26 +0000)
committerNick Clifton <nickc@redhat.com>
Tue, 3 Jan 2017 15:26:27 +0000 (15:26 +0000)
bfd/ChangeLog
bfd/mach-o.c

index 420f1fc6d0500cb40b292ddddb5da1022485f87f..1e82218e9c19661e11e64b1e64dfcc8562f8f2d6 100644 (file)
@@ -1,3 +1,8 @@
+2017-01-03  Nick Clifton  <nickc@redhat.com>
+
+       * mach-o.c (bfd_mach_o_lookup_uuid_command): Fix compile time
+       warning about using a possibly uninitialised variable.
+
 2017-01-02  Alan Modra  <amodra@gmail.com>
 
        * elf32-hppa.c (ensure_undef_weak_dynamic): New function.
index 8bf1149de001c043af3c7dae9e8096d0b6b9e852..edfac158a9cdfbb1981987cddec93ae2582370b4 100644 (file)
@@ -5641,9 +5641,9 @@ bfd_mach_o_core_file_failing_signal (bfd *abfd ATTRIBUTE_UNUSED)
 static bfd_mach_o_uuid_command *
 bfd_mach_o_lookup_uuid_command (bfd *abfd)
 {
-  bfd_mach_o_load_command *uuid_cmd;
+  bfd_mach_o_load_command *uuid_cmd = NULL;
   int ncmd = bfd_mach_o_lookup_command (abfd, BFD_MACH_O_LC_UUID, &uuid_cmd);
-  if (ncmd != 1)
+  if (ncmd != 1 || uuid_cmd == NULL)
     return FALSE;
   return &uuid_cmd->command.uuid;
 }