This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb] Fix compile time warning about using a possibly uninitialised variable.


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=09fe2662a708aa4da665bcaf942b5529e6809220

commit 09fe2662a708aa4da665bcaf942b5529e6809220
Author: Nick Clifton <nickc@redhat.com>
Date:   Tue Jan 3 15:26:27 2017 +0000

    Fix compile time warning about using a possibly uninitialised variable.

Diff:
---
 bfd/ChangeLog | 5 +++++
 bfd/mach-o.c  | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 420f1fc..1e82218 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -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.
diff --git a/bfd/mach-o.c b/bfd/mach-o.c
index 8bf1149..edfac15 100644
--- a/bfd/mach-o.c
+++ b/bfd/mach-o.c
@@ -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;
 }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]