gdbsupport: re-indent ptrace.m4
[deliverable/binutils-gdb.git] / binutils / rddbg.c
index 2a238737bb7748f9faf3f69f67ab0879c756036e..f8ea2f99afaa5a6f04c094bd59c3125962766279 100644 (file)
@@ -1,5 +1,5 @@
 /* rddbg.c -- Read debugging information into a generic form.
-   Copyright (C) 1995-2018 Free Software Foundation, Inc.
+   Copyright (C) 1995-2020 Free Software Foundation, Inc.
    Written by Ian Lance Taylor <ian@cygnus.com>.
 
    This file is part of GNU Binutils.
@@ -43,7 +43,8 @@ static void free_saved_stabs (void);
    pointer.  */
 
 void *
-read_debugging_info (bfd *abfd, asymbol **syms, long symcount, bfd_boolean no_messages)
+read_debugging_info (bfd *abfd, asymbol **syms, long symcount,
+                    bfd_boolean no_messages)
 {
   void *dhandle;
   bfd_boolean found;
@@ -54,13 +55,13 @@ read_debugging_info (bfd *abfd, asymbol **syms, long symcount, bfd_boolean no_me
 
   if (! read_section_stabs_debugging_info (abfd, syms, symcount, dhandle,
                                           &found))
-    return NULL;
+    goto err_exit;
 
   if (bfd_get_flavour (abfd) == bfd_target_aout_flavour)
     {
       if (! read_symbol_stabs_debugging_info (abfd, syms, symcount, dhandle,
                                              &found))
-       return NULL;
+       goto err_exit;
     }
 
   /* Try reading the COFF symbols if we didn't find any stabs in COFF
@@ -70,7 +71,7 @@ read_debugging_info (bfd *abfd, asymbol **syms, long symcount, bfd_boolean no_me
       && symcount > 0)
     {
       if (! parse_coff (abfd, syms, symcount, dhandle))
-       return NULL;
+       goto err_exit;
       found = TRUE;
     }
 
@@ -79,6 +80,8 @@ read_debugging_info (bfd *abfd, asymbol **syms, long symcount, bfd_boolean no_me
       if (! no_messages)
        non_fatal (_("%s: no recognized debugging information"),
                   bfd_get_filename (abfd));
+    err_exit:
+      free (dhandle);
       return NULL;
     }
 
@@ -121,7 +124,7 @@ read_section_stabs_debugging_info (bfd *abfd, asymbol **syms, long symcount,
          bfd_byte *stab;
          bfd_size_type stroff, next_stroff;
 
-         stabsize = bfd_section_size (abfd, sec);
+         stabsize = bfd_section_size (sec);
          stabs = (bfd_byte *) xmalloc (stabsize);
          if (! bfd_get_section_contents (abfd, sec, stabs, 0, stabsize))
            {
@@ -133,7 +136,7 @@ read_section_stabs_debugging_info (bfd *abfd, asymbol **syms, long symcount,
              return FALSE;
            }
 
-         strsize = bfd_section_size (abfd, strsec);
+         strsize = bfd_section_size (strsec);
          strings = (bfd_byte *) xmalloc (strsize + 1);
          if (! bfd_get_section_contents (abfd, strsec, strings, 0, strsize))
            {
@@ -319,8 +322,7 @@ read_symbol_stabs_debugging_info (bfd *abfd, asymbol **syms, long symcount,
              sc[strlen (sc) - 1] = '\0';
              n = concat (sc, bfd_asymbol_name (*ps), (const char *) NULL);
              free (sc);
-             if (f != NULL)
-               free (f);
+             free (f);
              f = n;
              s = n;
            }
@@ -372,8 +374,7 @@ static int saved_stabs_index;
 static void
 save_stab (int type, int desc, bfd_vma value, const char *string)
 {
-  if (saved_stabs[saved_stabs_index].string != NULL)
-    free (saved_stabs[saved_stabs_index].string);
+  free (saved_stabs[saved_stabs_index].string);
   saved_stabs[saved_stabs_index].type = type;
   saved_stabs[saved_stabs_index].desc = desc;
   saved_stabs[saved_stabs_index].value = value;
@@ -428,11 +429,8 @@ free_saved_stabs (void)
 
   for (i = 0; i < SAVE_STABS_COUNT; i++)
     {
-      if (saved_stabs[i].string != NULL)
-       {
-         free (saved_stabs[i].string);
-         saved_stabs[i].string = NULL;
-       }
+      free (saved_stabs[i].string);
+      saved_stabs[i].string = NULL;
     }
 
   saved_stabs_index = 0;
This page took 0.025765 seconds and 4 git commands to generate.