coff-alpha memory leak
authorAlan Modra <amodra@gmail.com>
Thu, 19 Dec 2019 23:31:03 +0000 (10:01 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 20 Dec 2019 03:06:06 +0000 (13:36 +1030)
* coff-alpha.c (alpha_ecoff_read_ar_hdr): Free ar_hdr on error return.

bfd/ChangeLog
bfd/coff-alpha.c

index dc264de3cc360cd741a32c6d3de1b7350e9bed00..c399eac35ac2753a481fef6ae93e118377a40bbc 100644 (file)
@@ -1,3 +1,7 @@
+2019-12-20  Alan Modra  <amodra@gmail.com>
+
+       * coff-alpha.c (alpha_ecoff_read_ar_hdr): Free ar_hdr on error return.
+
 2019-12-18  Alan Modra  <amodra@gmail.com>
 
        * coff-rs6000.c (_bfd_xcoff_slurp_armap): Don't overflow when
index d36921bbfe6784523bbbd533ccfdbfa93fe9d701..fe7fcb143de71a0885e0be171b4a5f44bff19ce2 100644 (file)
@@ -2026,7 +2026,10 @@ alpha_ecoff_read_ar_hdr (bfd *abfd)
       if (bfd_seek (abfd, (file_ptr) FILHSZ, SEEK_CUR) != 0
          || bfd_bread (ab, (bfd_size_type) 8, abfd) != 8
          || bfd_seek (abfd, (file_ptr) (- (FILHSZ + 8)), SEEK_CUR) != 0)
-       return NULL;
+       {
+         free (ret);
+         return NULL;
+       }
 
       ret->parsed_size = H_GET_64 (abfd, ab);
     }