Blame SOURCES/binutils-coverity-fixes.patch

4ede5d
--- binutils.orig/bfd/archive.c	2019-10-04 15:26:08.544327573 +0100
4ede5d
+++ binutils-2.30/bfd/archive.c	2019-10-04 16:58:45.088039134 +0100
4ede5d
@@ -734,6 +734,9 @@ _bfd_get_elt_at_filepos (bfd *archive, f
4ede5d
   /* Copy is_linker_input.  */
4ede5d
   n_bfd->is_linker_input = archive->is_linker_input;
4ede5d
 
4ede5d
+  /* Coverity does not realise that _bfd_add_bfd_to_archive_cache actually
4ede5d
+     stores the newly created bfd and so flags a resource leak.  */
4ede5d
+  /* coverity[noescape: FALSE] */
4ede5d
   if (_bfd_add_bfd_to_archive_cache (archive, filepos, n_bfd))
4ede5d
     return n_bfd;
4ede5d
 
4ede5d
diff -rup binutils.orig/bfd/coffcode.h binutils-2.30/bfd/coffcode.h
4ede5d
--- binutils.orig/bfd/coffcode.h	2019-10-07 15:49:39.425618524 +0100
4ede5d
+++ binutils-2.30/bfd/coffcode.h	2019-10-07 15:53:18.335157361 +0100
4ede5d
@@ -3737,6 +3737,9 @@ coff_write_object_contents (bfd * abfd)
4ede5d
 
4ede5d
       internal_f.f_nscns++;
4ede5d
 
4ede5d
+      /* Coverity flags this strncpy as possibly creating a string
4ede5d
+	 that is not NUL terminated.  This is in fact OK.  */
4ede5d
+      /* coverity[buffer_size_warning: FALSE] */
4ede5d
       strncpy (section.s_name, current->name, SCNNMLEN);
4ede5d
 
4ede5d
 #ifdef COFF_LONG_SECTION_NAMES
4ede5d
@@ -3775,6 +3778,9 @@ coff_write_object_contents (bfd * abfd)
4ede5d
 		 buffer, just in case.  */
4ede5d
 	      sprintf (s_name_buf, "/%lu", (unsigned long) string_size);
4ede5d
 	      /* Then strncpy takes care of any padding for us.  */
4ede5d
+	      /* Coverity flags this strncpy as possibly creating a string
4ede5d
+		 that is not NUL terminated.  This is in fact OK.  */
4ede5d
+	      /* coverity[buffer_size_warning: FALSE] */
4ede5d
 	      strncpy (section.s_name, s_name_buf, SCNNMLEN);
4ede5d
 	      string_size += len + 1;
4ede5d
 	      long_section_names = TRUE;
4ede5d
diff -rup binutils.orig/bfd/coffgen.c binutils-2.30/bfd/coffgen.c
4ede5d
--- binutils.orig/bfd/coffgen.c	2019-10-07 15:49:37.845629069 +0100
4ede5d
+++ binutils-2.30/bfd/coffgen.c	2019-10-07 15:53:46.443969714 +0100
4ede5d
@@ -923,6 +923,9 @@ coff_fix_symbol_name (bfd *abfd,
4ede5d
     {
4ede5d
       if (name_length <= SYMNMLEN && !bfd_coff_force_symnames_in_strings (abfd))
4ede5d
 	/* This name will fit into the symbol neatly.  */
4ede5d
+	/* Coverity flags this strncpy as possibly creating a string
4ede5d
+	   that is not NUL terminated.  This is in fact OK.  */
4ede5d
+	/* coverity[buffer_size_warning: FALSE] */
4ede5d
 	strncpy (native->u.syment._n._n_name, symbol->name, SYMNMLEN);
4ede5d
 
4ede5d
       else if (!bfd_coff_symname_in_debug (abfd, &native->u.syment))
4ede5d
diff -rup binutils.orig/bfd/cofflink.c binutils-2.30/bfd/cofflink.c
4ede5d
--- binutils.orig/bfd/cofflink.c	2019-10-07 15:49:37.565630938 +0100
4ede5d
+++ binutils-2.30/bfd/cofflink.c	2019-10-07 15:54:21.177736099 +0100
4ede5d
@@ -2633,6 +2633,9 @@ _bfd_coff_write_global_sym (struct bfd_h
4ede5d
     }
4ede5d
 
4ede5d
   if (strlen (h->root.root.string) <= SYMNMLEN)
4ede5d
+    /* Coverity flags this strncpy as possibly creating a string
4ede5d
+       that is not NUL terminated.  This is in fact OK.  */
4ede5d
+    /* coverity[buffer_size_warning: FALSE] */
4ede5d
     strncpy (isym._n._n_name, h->root.root.string, SYMNMLEN);
4ede5d
   else
4ede5d
     {
4ede5d
diff -rup binutils.orig/bfd/elf64-x86-64.c binutils-2.30/bfd/elf64-x86-64.c
4ede5d
--- binutils.orig/bfd/elf64-x86-64.c	2019-10-07 15:49:38.144627073 +0100
4ede5d
+++ binutils-2.30/bfd/elf64-x86-64.c	2019-10-07 15:56:53.559674302 +0100
4ede5d
@@ -463,7 +463,13 @@ elf_x86_64_write_core_note (bfd *abfd, c
4ede5d
 	{
4ede5d
 	  prpsinfo32_t data;
4ede5d
 	  memset (&data, 0, sizeof (data));
4ede5d
+	  /* Coverity flags this strncpy as possibly creating a string
4ede5d
+	     that is not NUL terminated.  This is in fact OK.  */
4ede5d
+	  /* coverity[buffer_size_warning: FALSE] */
4ede5d
 	  strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
4ede5d
+	  /* Coverity flags this strncpy as possibly creating a string
4ede5d
+	     that is not NUL terminated.  This is in fact OK.  */
4ede5d
+	  /* coverity[buffer_size_warning: FALSE] */
4ede5d
 	  strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
4ede5d
 	  return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type,
4ede5d
 				     &data, sizeof (data));
4ede5d
@@ -472,7 +478,13 @@ elf_x86_64_write_core_note (bfd *abfd, c
4ede5d
 	{
4ede5d
 	  prpsinfo64_t data;
4ede5d
 	  memset (&data, 0, sizeof (data));
4ede5d
+	  /* Coverity flags this strncpy as possibly creating a string
4ede5d
+	     that is not NUL terminated.  This is in fact OK.  */
4ede5d
+	  /* coverity[buffer_size_warning: FALSE] */
4ede5d
 	  strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
4ede5d
+	  /* Coverity flags this strncpy as possibly creating a string
4ede5d
+	     that is not NUL terminated.  This is in fact OK.  */
4ede5d
+	  /* coverity[buffer_size_warning: FALSE] */
4ede5d
 	  strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
4ede5d
 	  return elfcore_write_note (abfd, buf, bufsiz, "CORE", note_type,
4ede5d
 				     &data, sizeof (data));
4ede5d
diff -rup binutils.orig/bfd/elf.c binutils-2.30/bfd/elf.c
4ede5d
--- binutils.orig/bfd/elf.c	2019-10-07 15:49:37.616630597 +0100
4ede5d
+++ binutils-2.30/bfd/elf.c	2019-10-07 15:56:16.776930603 +0100
4ede5d
@@ -10549,7 +10549,13 @@ elfcore_write_prpsinfo (bfd  *abfd,
4ede5d
 #endif
4ede5d
 
4ede5d
       memset (&data, 0, sizeof (data));
4ede5d
+      /* Coverity flags this strncpy as possibly creating a string
4ede5d
+	 that is not NUL terminated.  This is in fact OK.  */
4ede5d
+      /* coverity[buffer_size_warning: FALSE] */
4ede5d
       strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
4ede5d
+      /* Coverity flags this strncpy as possibly creating a string
4ede5d
+	 that is not NUL terminated.  This is in fact OK.  */
4ede5d
+      /* coverity[buffer_size_warning: FALSE] */
4ede5d
       strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
4ede5d
       return elfcore_write_note (abfd, buf, bufsiz,
4ede5d
 				 "CORE", note_type, &data, sizeof (data));
4ede5d
@@ -10566,7 +10572,13 @@ elfcore_write_prpsinfo (bfd  *abfd,
4ede5d
 #endif
4ede5d
 
4ede5d
       memset (&data, 0, sizeof (data));
4ede5d
+      /* Coverity flags this strncpy as possibly creating a string
4ede5d
+	 that is not NUL terminated.  This is in fact OK.  */
4ede5d
+      /* coverity[buffer_size_warning: FALSE] */
4ede5d
       strncpy (data.pr_fname, fname, sizeof (data.pr_fname));
4ede5d
+      /* Coverity flags this strncpy as possibly creating a string
4ede5d
+	 that is not NUL terminated.  This is in fact OK.  */
4ede5d
+      /* coverity[buffer_size_warning: FALSE] */
4ede5d
       strncpy (data.pr_psargs, psargs, sizeof (data.pr_psargs));
4ede5d
       return elfcore_write_note (abfd, buf, bufsiz,
4ede5d
 				 "CORE", note_type, &data, sizeof (data));
4ede5d
diff -rup binutils.orig/bfd/elf-linux-core.h binutils-2.30/bfd/elf-linux-core.h
4ede5d
--- binutils.orig/bfd/elf-linux-core.h	2019-10-07 15:49:37.744629743 +0100
4ede5d
+++ binutils-2.30/bfd/elf-linux-core.h	2019-10-07 15:55:43.976159158 +0100
4ede5d
@@ -69,7 +69,13 @@ swap_linux_prpsinfo32_ugid32_out
4ede5d
   bfd_put_32 (obfd, from->pr_ppid, to->pr_ppid);
4ede5d
   bfd_put_32 (obfd, from->pr_pgrp, to->pr_pgrp);
4ede5d
   bfd_put_32 (obfd, from->pr_sid, to->pr_sid);
4ede5d
+  /* Coverity flags this strncpy as possibly creating a string
4ede5d
+     that is not NUL terminated.  This is in fact OK.  */
4ede5d
+  /* coverity[buffer_size_warning: FALSE] */
4ede5d
   strncpy (to->pr_fname, from->pr_fname, sizeof (to->pr_fname));
4ede5d
+  /* Coverity flags this strncpy as possibly creating a string
4ede5d
+     that is not NUL terminated.  This is in fact OK.  */
4ede5d
+  /* coverity[buffer_size_warning: FALSE] */
4ede5d
   strncpy (to->pr_psargs, from->pr_psargs, sizeof (to->pr_psargs));
4ede5d
 }
4ede5d
 
4ede5d
@@ -121,7 +127,13 @@ swap_linux_prpsinfo32_ugid16_out
4ede5d
   bfd_put_32 (obfd, from->pr_ppid, to->pr_ppid);
4ede5d
   bfd_put_32 (obfd, from->pr_pgrp, to->pr_pgrp);
4ede5d
   bfd_put_32 (obfd, from->pr_sid, to->pr_sid);
4ede5d
+  /* Coverity flags this strncpy as possibly creating a string
4ede5d
+     that is not NUL terminated.  This is in fact OK.  */
4ede5d
+  /* coverity[buffer_size_warning: FALSE] */
4ede5d
   strncpy (to->pr_fname, from->pr_fname, sizeof (to->pr_fname));
4ede5d
+  /* Coverity flags this strncpy as possibly creating a string
4ede5d
+     that is not NUL terminated.  This is in fact OK.  */
4ede5d
+  /* coverity[buffer_size_warning: FALSE] */
4ede5d
   strncpy (to->pr_psargs, from->pr_psargs, sizeof (to->pr_psargs));
4ede5d
 }
4ede5d
 
4ede5d
@@ -174,7 +186,13 @@ swap_linux_prpsinfo64_ugid32_out
4ede5d
   bfd_put_32 (obfd, from->pr_ppid, to->pr_ppid);
4ede5d
   bfd_put_32 (obfd, from->pr_pgrp, to->pr_pgrp);
4ede5d
   bfd_put_32 (obfd, from->pr_sid, to->pr_sid);
4ede5d
+  /* Coverity flags this strncpy as possibly creating a string
4ede5d
+     that is not NUL terminated.  This is in fact OK.  */
4ede5d
+  /* coverity[buffer_size_warning: FALSE] */
4ede5d
   strncpy (to->pr_fname, from->pr_fname, sizeof (to->pr_fname));
4ede5d
+  /* Coverity flags this strncpy as possibly creating a string
4ede5d
+     that is not NUL terminated.  This is in fact OK.  */
4ede5d
+  /* coverity[buffer_size_warning: FALSE] */
4ede5d
   strncpy (to->pr_psargs, from->pr_psargs, sizeof (to->pr_psargs));
4ede5d
 }
4ede5d
 
4ede5d
@@ -227,7 +245,13 @@ swap_linux_prpsinfo64_ugid16_out
4ede5d
   bfd_put_32 (obfd, from->pr_ppid, to->pr_ppid);
4ede5d
   bfd_put_32 (obfd, from->pr_pgrp, to->pr_pgrp);
4ede5d
   bfd_put_32 (obfd, from->pr_sid, to->pr_sid);
4ede5d
+  /* Coverity flags this strncpy as possibly creating a string
4ede5d
+     that is not NUL terminated.  This is in fact OK.  */
4ede5d
+  /* coverity[buffer_size_warning: FALSE] */
4ede5d
   strncpy (to->pr_fname, from->pr_fname, sizeof (to->pr_fname));
4ede5d
+  /* Coverity flags this strncpy as possibly creating a string
4ede5d
+     that is not NUL terminated.  This is in fact OK.  */
4ede5d
+  /* coverity[buffer_size_warning: FALSE] */
4ede5d
   strncpy (to->pr_psargs, from->pr_psargs, sizeof (to->pr_psargs));
4ede5d
 }
4ede5d
 
4ede5d
diff -rup binutils.orig/bfd/peXXigen.c binutils-2.30/bfd/peXXigen.c
4ede5d
--- binutils.orig/bfd/peXXigen.c	2019-10-07 15:49:37.695630070 +0100
4ede5d
+++ binutils-2.30/bfd/peXXigen.c	2019-10-07 16:02:02.117524278 +0100
4ede5d
@@ -385,7 +385,7 @@ _bfd_XXi_swap_aux_out (bfd *  abfd,
4ede5d
 	  H_PUT_32 (abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset);
4ede5d
 	}
4ede5d
       else
4ede5d
-	memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
4ede5d
+	memcpy (ext->x_file.x_fname, in->x_file.x_fname, E_FILNMLEN);
4ede5d
 
4ede5d
       return AUXESZ;
4ede5d
 
4ede5d
diff -rup binutils.orig/ld/pe-dll.c binutils-2.30/ld/pe-dll.c
4ede5d
--- binutils.orig/ld/pe-dll.c	2019-10-07 15:48:49.851949423 +0100
4ede5d
+++ binutils-2.30/ld/pe-dll.c	2019-10-07 16:04:09.055639773 +0100
4ede5d
@@ -2929,7 +2929,7 @@ pe_find_cdecl_alias_match (struct bfd_li
4ede5d
 	  if (pe_details->underscored)
4ede5d
 	    lname[0] = '_';
4ede5d
 	  else
4ede5d
-	    strcpy (lname, lname + 1);
4ede5d
+	    memmove (lname, lname + 1, strlen (lname) + 1);
4ede5d
 	  key.key = lname;
4ede5d
 	  kv = bsearch (&key, udef_table, undef_count,
4ede5d
 			sizeof (struct key_value), undef_sort_cmp);
4ede5d
diff -rup binutils.orig/libiberty/sha1.c binutils-2.30/libiberty/sha1.c
4ede5d
--- binutils.orig/libiberty/sha1.c	2019-10-07 15:49:37.016634602 +0100
4ede5d
+++ binutils-2.30/libiberty/sha1.c	2019-10-07 16:04:41.788411691 +0100
4ede5d
@@ -258,7 +258,7 @@ sha1_process_bytes (const void *buffer,
4ede5d
 	{
4ede5d
 	  sha1_process_block (ctx->buffer, 64, ctx);
4ede5d
 	  left_over -= 64;
4ede5d
-	  memcpy (ctx->buffer, &ctx->buffer[16], left_over);
4ede5d
+	  memmove (ctx->buffer, &ctx->buffer[16], left_over);
4ede5d
 	}
4ede5d
       ctx->buflen = left_over;
4ede5d
     }
4ede5d
diff -rup binutils.orig/bfd/cofflink.c binutils-2.30/bfd/cofflink.c
4ede5d
--- binutils.orig/bfd/cofflink.c	2019-10-07 17:01:58.787679337 +0100
4ede5d
+++ binutils-2.30/bfd/cofflink.c	2019-10-07 17:02:20.641529805 +0100
4ede5d
@@ -1406,6 +1406,8 @@ mark_relocs (struct coff_final_link_info
4ede5d
       for (; irel < irelend; irel++)
4ede5d
 	if ((unsigned long) irel->r_symndx < obj_raw_syment_count (input_bfd))
4ede5d
 	  flaginfo->sym_indices[irel->r_symndx] = -1;
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
     }
4ede5d
 }
4ede5d
 
4ede5d
diff -rup binutils.orig/bfd/doc/chew.c binutils-2.30/bfd/doc/chew.c
4ede5d
--- binutils.orig/bfd/doc/chew.c	2019-10-07 17:01:58.796679276 +0100
4ede5d
+++ binutils-2.30/bfd/doc/chew.c	2019-10-07 17:04:21.265720634 +0100
4ede5d
@@ -1264,6 +1264,7 @@ free_words (void)
4ede5d
 	    if (ptr->code[i] == push_text
4ede5d
 		&& ptr->code[i + 1])
4ede5d
 	      {
4ede5d
+		/* coverity[fnptr_free: FALSE] */
4ede5d
 		free (ptr->code[i + 1] - 1);
4ede5d
 		++ i;
4ede5d
 	      }
4ede5d
@@ -1387,6 +1388,7 @@ compile (string)
4ede5d
 	  ptr = newentry (word);
4ede5d
 	  string = nextword (string, &word);
4ede5d
 	  
4ede5d
+	  /* coverity[use_after_free: FALSE] */
4ede5d
 	  while (word[0] != ';')
4ede5d
 	    {
4ede5d
 	      switch (word[0])
4ede5d
diff -rup binutils.orig/bfd/elflink.c binutils-2.30/bfd/elflink.c
4ede5d
--- binutils.orig/bfd/elflink.c	2019-10-07 17:01:58.779679392 +0100
4ede5d
+++ binutils-2.30/bfd/elflink.c	2019-10-07 17:04:57.025483171 +0100
4ede5d
@@ -10579,6 +10579,8 @@ elf_link_input_bfd (struct elf_final_lin
4ede5d
 			   "that references a non-existent global symbol"),
4ede5d
 			 input_bfd, rel->r_info, o);
4ede5d
 		      bfd_set_error (bfd_error_bad_value);
4ede5d
+		      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+		      /* coverity[leaked_storage: FALSE] */
4ede5d
 		      return FALSE;
4ede5d
 		    }
4ede5d
 
4ede5d
diff -rup binutils.orig/bfd/peXXigen.c binutils-2.30/bfd/peXXigen.c
4ede5d
--- binutils.orig/bfd/peXXigen.c	2019-10-07 17:01:58.784679358 +0100
4ede5d
+++ binutils-2.30/bfd/peXXigen.c	2019-10-07 17:07:22.047520136 +0100
4ede5d
@@ -385,7 +385,9 @@ _bfd_XXi_swap_aux_out (bfd *  abfd,
4ede5d
 	  H_PUT_32 (abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset);
4ede5d
 	}
4ede5d
       else
4ede5d
-	memcpy (ext->x_file.x_fname, in->x_file.x_fname, E_FILNMLEN);
4ede5d
+	/* Coverity gets confused about the size of these buffers.  */
4ede5d
+	/* coverity[buffer_size: FALSE] */
4ede5d
+	memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
4ede5d
 
4ede5d
       return AUXESZ;
4ede5d
 
4ede5d
@@ -4343,6 +4345,8 @@ rsrc_process_section (bfd * abfd,
4ede5d
   /* FIXME: Free the resource tree, if we have one.  */
4ede5d
   free (datastart);
4ede5d
   free (rsrc_sizes);
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
 }
4ede5d
 
4ede5d
 /* Handle the .idata section and other things that need symbol table
4ede5d
diff -rup binutils.orig/bfd/plugin.c binutils-2.30/bfd/plugin.c
4ede5d
--- binutils.orig/bfd/plugin.c	2019-10-07 17:01:58.780679385 +0100
4ede5d
+++ binutils-2.30/bfd/plugin.c	2019-10-07 17:07:45.871361935 +0100
4ede5d
@@ -403,9 +403,13 @@ try_load_plugin (const char *pname, bfd
4ede5d
 
4ede5d
   abfd->plugin_format = bfd_plugin_yes;
4ede5d
 
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
   return 1;
4ede5d
 
4ede5d
  err:
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
   return 0;
4ede5d
 }
4ede5d
 
4ede5d
diff -rup binutils.orig/bfd/stabs.c binutils-2.30/bfd/stabs.c
4ede5d
--- binutils.orig/bfd/stabs.c	2019-10-07 17:01:58.778679399 +0100
4ede5d
+++ binutils-2.30/bfd/stabs.c	2019-10-07 17:08:14.655170795 +0100
4ede5d
@@ -377,6 +377,8 @@ _bfd_link_section_stabs (bfd *abfd,
4ede5d
 	  amt = sizeof *ne;
4ede5d
 	  ne = (struct stab_excl_list *) bfd_alloc (abfd, amt);
4ede5d
 	  if (ne == NULL)
4ede5d
+	    /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	    /* coverity[leaked_storage: FALSE] */
4ede5d
 	    goto error_return;
4ede5d
 	  ne->offset = sym - stabbuf;
4ede5d
 	  ne->val = sum_chars;
4ede5d
diff -rup binutils.orig/binutils/ar.c binutils-2.30/binutils/ar.c
4ede5d
--- binutils.orig/binutils/ar.c	2019-10-07 17:01:57.998684736 +0100
4ede5d
+++ binutils-2.30/binutils/ar.c	2019-10-07 17:10:18.109350993 +0100
4ede5d
@@ -228,6 +228,8 @@ map_over_members (bfd *arch, void (*func
4ede5d
 	      filename = normalize (filename, arch);
4ede5d
 	    }
4ede5d
 
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  if (filename != NULL
4ede5d
 	      && !FILENAME_CMP (normalize (*files, arch), filename))
4ede5d
 	    {
4ede5d
@@ -237,6 +239,8 @@ map_over_members (bfd *arch, void (*func
4ede5d
 		{
4ede5d
 		  /* Counting, and didn't match on count; go on to the
4ede5d
                      next one.  */
4ede5d
+		  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+		  /* coverity[leaked_storage: FALSE] */
4ede5d
 		  continue;
4ede5d
 		}
4ede5d
 
4ede5d
@@ -250,6 +254,8 @@ map_over_members (bfd *arch, void (*func
4ede5d
 		 to the ar command.  */
4ede5d
 	      break;
4ede5d
 	    }
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	}
4ede5d
 
4ede5d
       if (!found)
4ede5d
@@ -1268,6 +1274,8 @@ delete_members (bfd *arch, char **files_
4ede5d
       current_ptr_ptr = &(arch->archive_next);
4ede5d
       while (*current_ptr_ptr)
4ede5d
 	{
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  if (FILENAME_CMP (normalize (*files_to_delete, arch),
4ede5d
 			    (*current_ptr_ptr)->filename) == 0)
4ede5d
 	    {
4ede5d
@@ -1323,6 +1331,8 @@ move_members (bfd *arch, char **files_to
4ede5d
       while (*current_ptr_ptr)
4ede5d
 	{
4ede5d
 	  bfd *current_ptr = *current_ptr_ptr;
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  if (FILENAME_CMP (normalize (*files_to_move, arch),
4ede5d
 			    current_ptr->filename) == 0)
4ede5d
 	    {
4ede5d
@@ -1375,6 +1385,8 @@ replace_members (bfd *arch, char **files
4ede5d
 
4ede5d
 	      /* For compatibility with existing ar programs, we
4ede5d
 		 permit the same file to be added multiple times.  */
4ede5d
+	      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	      /* coverity[leaked_storage: FALSE] */
4ede5d
 	      if (FILENAME_CMP (normalize (*files_to_move, arch),
4ede5d
 				normalize (current->filename, arch)) == 0
4ede5d
 		  && current->arelt_data != NULL)
4ede5d
diff -rup binutils.orig/binutils/arparse.c binutils-2.30/binutils/arparse.c
4ede5d
--- binutils.orig/binutils/arparse.c	2019-10-07 17:01:58.003684702 +0100
4ede5d
+++ binutils-2.30/binutils/arparse.c	2019-10-07 17:10:55.998099392 +0100
4ede5d
@@ -1193,6 +1193,8 @@ yyparse (void)
4ede5d
 #  undef YYSTACK_RELOCATE
4ede5d
         if (yyss1 != yyssa)
4ede5d
           YYSTACK_FREE (yyss1);
4ede5d
+	/* There is a potential resource leak here, but it is not important.  */
4ede5d
+	/* coverity[leaked_storage: FALSE] */
4ede5d
       }
4ede5d
 # endif
4ede5d
 #endif /* no yyoverflow */
4ede5d
diff -rup binutils.orig/binutils/arsup.c binutils-2.30/binutils/arsup.c
4ede5d
--- binutils.orig/binutils/arsup.c	2019-10-07 17:01:58.006684681 +0100
4ede5d
+++ binutils-2.30/binutils/arsup.c	2019-10-07 17:11:21.789928112 +0100
4ede5d
@@ -209,6 +209,8 @@ ar_open (char *name, int t)
4ede5d
       obfd->has_armap = 1;
4ede5d
       obfd->is_thin_archive = 0;
4ede5d
     }
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
 }
4ede5d
 
4ede5d
 static void
4ede5d
diff -rup binutils.orig/binutils/dwarf.c binutils-2.30/binutils/dwarf.c
4ede5d
--- binutils.orig/binutils/dwarf.c	2019-10-07 17:01:57.958685010 +0100
4ede5d
+++ binutils-2.30/binutils/dwarf.c	2019-10-07 17:13:31.950063779 +0100
4ede5d
@@ -4098,6 +4098,8 @@ display_debug_lines_decoded (struct dwar
4ede5d
 	      if (data == end)
4ede5d
 		{
4ede5d
 		  warn (_("Corrupt file name list\n"));
4ede5d
+		  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+		  /* coverity[leaked_storage: FALSE] */
4ede5d
 		  break;
4ede5d
 		}
4ede5d
 
4ede5d
@@ -4234,6 +4236,8 @@ display_debug_lines_decoded (struct dwar
4ede5d
 		    {
4ede5d
 		      warn (_("file table ends unexpectedly\n"));
4ede5d
 		      n_files = 0;
4ede5d
+		      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+		      /* coverity[leaked_storage: FALSE] */
4ede5d
 		      break;
4ede5d
 		    }
4ede5d
 
4ede5d
@@ -7231,6 +7235,8 @@ read_cie (unsigned char *start, unsigned
4ede5d
   if (start == end)
4ede5d
     {
4ede5d
       warn (_("No terminator for augmentation name\n"));
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
       return start;
4ede5d
     }
4ede5d
 
4ede5d
@@ -7243,6 +7249,8 @@ read_cie (unsigned char *start, unsigned
4ede5d
       if (fc->ptr_size < 1 || fc->ptr_size > 8)
4ede5d
 	{
4ede5d
 	  warn (_("Invalid pointer size (%d) in CIE data\n"), fc->ptr_size);
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return end;
4ede5d
 	}
4ede5d
 
4ede5d
@@ -7251,6 +7259,8 @@ read_cie (unsigned char *start, unsigned
4ede5d
       if (fc->segment_size > 8 || fc->segment_size + fc->ptr_size > 8)
4ede5d
 	{
4ede5d
 	  warn (_("Invalid segment size (%d) in CIE data\n"), fc->segment_size);
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return end;
4ede5d
 	}
4ede5d
 
4ede5d
@@ -8305,6 +8315,8 @@ display_debug_frames (struct dwarf_secti
4ede5d
 
4ede5d
   printf ("\n");
4ede5d
 
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
   return 1;
4ede5d
 }
4ede5d
 
4ede5d
@@ -9733,6 +9745,8 @@ load_separate_debug_info (const char *
4ede5d
   if (debugfile == NULL)
4ede5d
     {
4ede5d
       warn (_("Out of memory"));
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
       return NULL;
4ede5d
     }
4ede5d
 
4ede5d
diff -rup binutils.orig/binutils/elfedit.c binutils-2.30/binutils/elfedit.c
4ede5d
--- binutils.orig/binutils/elfedit.c	2019-10-07 17:01:58.000684722 +0100
4ede5d
+++ binutils-2.30/binutils/elfedit.c	2019-10-07 17:13:51.916931183 +0100
4ede5d
@@ -468,6 +468,8 @@ process_archive (const char * file_name,
4ede5d
         }
4ede5d
 
4ede5d
       free (qualified_name);
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
     }
4ede5d
 
4ede5d
  out:
4ede5d
diff -rup binutils.orig/binutils/ieee.c binutils-2.30/binutils/ieee.c
4ede5d
--- binutils.orig/binutils/ieee.c	2019-10-07 17:01:57.963684975 +0100
4ede5d
+++ binutils-2.30/binutils/ieee.c	2019-10-07 17:18:54.442922250 +0100
4ede5d
@@ -1503,6 +1503,8 @@ parse_ieee_ty (struct ieee_info *info, c
4ede5d
 	    bfd_boolean present;
4ede5d
 
4ede5d
 	    if (! ieee_read_optional_id (info, pp, &name, &namlen, &present))
4ede5d
+	      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	      /* coverity[leaked_storage: FALSE] */
4ede5d
 	      return FALSE;
4ede5d
 	    if (! present)
4ede5d
 	      break;
4ede5d
@@ -1516,6 +1518,8 @@ parse_ieee_ty (struct ieee_info *info, c
4ede5d
 
4ede5d
 	    names[c] = savestring (name, namlen);
4ede5d
 	    if (names[c] == NULL)
4ede5d
+	      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	      /* coverity[leaked_storage: FALSE] */
4ede5d
 	      return FALSE;
4ede5d
 	    ++c;
4ede5d
 	  }
4ede5d
@@ -1554,12 +1558,16 @@ parse_ieee_ty (struct ieee_info *info, c
4ede5d
 	    bfd_vma bitpos, bitsize;
4ede5d
 
4ede5d
 	    if (! ieee_read_optional_id (info, pp, &name, &namlen, &present))
4ede5d
+	      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	      /* coverity[leaked_storage: FALSE] */
4ede5d
 	      return FALSE;
4ede5d
 	    if (! present)
4ede5d
 	      break;
4ede5d
 	    if (! ieee_read_type_index (info, pp, &ftype)
4ede5d
 		|| ! ieee_read_number (info, pp, &bitpos)
4ede5d
 		|| ! ieee_read_number (info, pp, &bitsize))
4ede5d
+	      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	      /* coverity[leaked_storage: FALSE] */
4ede5d
 	      return FALSE;
4ede5d
 
4ede5d
 	    if (c + 1 >= alloc)
4ede5d
@@ -1573,6 +1581,8 @@ parse_ieee_ty (struct ieee_info *info, c
4ede5d
 					  ftype, bitpos, bitsize,
4ede5d
 					  DEBUG_VISIBILITY_PUBLIC);
4ede5d
 	    if (fields[c] == NULL)
4ede5d
+	      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	      /* coverity[leaked_storage: FALSE] */
4ede5d
 	      return FALSE;
4ede5d
 	    ++c;
4ede5d
 	  }
4ede5d
@@ -1604,10 +1614,14 @@ parse_ieee_ty (struct ieee_info *info, c
4ede5d
 	    bfd_vma val;
4ede5d
 
4ede5d
 	    if (! ieee_read_optional_id (info, pp, &name, &namlen, &present))
4ede5d
+	      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	      /* coverity[leaked_storage: FALSE] */
4ede5d
 	      return FALSE;
4ede5d
 	    if (! present)
4ede5d
 	      break;
4ede5d
 	    if (! ieee_read_number (info, pp, &val))
4ede5d
+	      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	      /* coverity[leaked_storage: FALSE] */
4ede5d
 	      return FALSE;
4ede5d
 
4ede5d
 	    /* If the length of the name is zero, then the value is
4ede5d
@@ -1627,6 +1641,8 @@ parse_ieee_ty (struct ieee_info *info, c
4ede5d
 
4ede5d
 	    names[c] = savestring (name, namlen);
4ede5d
 	    if (names[c] == NULL)
4ede5d
+	      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	      /* coverity[leaked_storage: FALSE] */
4ede5d
 	      return FALSE;
4ede5d
 	    vals[c] = (bfd_signed_vma) val;
4ede5d
 	    ++c;
4ede5d
@@ -1646,6 +1662,8 @@ parse_ieee_ty (struct ieee_info *info, c
4ede5d
 	debug_type t;
4ede5d
 
4ede5d
 	if (! ieee_read_type_index (info, pp, &t))
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return FALSE;
4ede5d
 	type = debug_make_pointer_type (dhandle, t);
4ede5d
       }
4ede5d
@@ -1660,6 +1678,8 @@ parse_ieee_ty (struct ieee_info *info, c
4ede5d
 	    || ! ieee_read_number (info, pp, &high)
4ede5d
 	    || ! ieee_read_number (info, pp, &signedp)
4ede5d
 	    || ! ieee_read_number (info, pp, &size))
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return FALSE;
4ede5d
 
4ede5d
 	type = debug_make_range_type (dhandle,
4ede5d
@@ -1679,6 +1699,8 @@ parse_ieee_ty (struct ieee_info *info, c
4ede5d
 	unsigned int c;
4ede5d
 
4ede5d
 	if (! ieee_read_number (info, pp, &size))
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return FALSE;
4ede5d
 
4ede5d
 	alloc = 10;
4ede5d
@@ -1695,11 +1717,15 @@ parse_ieee_ty (struct ieee_info *info, c
4ede5d
 	    bfd_vma bitsize;
4ede5d
 
4ede5d
 	    if (! ieee_read_optional_id (info, pp, &name, &namlen, &present))
4ede5d
+	      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	      /* coverity[leaked_storage: FALSE] */
4ede5d
 	      return FALSE;
4ede5d
 	    if (! present)
4ede5d
 	      break;
4ede5d
 	    if (! ieee_read_number (info, pp, &tindx)
4ede5d
 		|| ! ieee_read_number (info, pp, &offset))
4ede5d
+	      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	      /* coverity[leaked_storage: FALSE] */
4ede5d
 	      return FALSE;
4ede5d
 
4ede5d
 	    if (tindx < 256)
4ede5d
@@ -1733,6 +1759,8 @@ parse_ieee_ty (struct ieee_info *info, c
4ede5d
 					  ftype, offset, bitsize,
4ede5d
 					  DEBUG_VISIBILITY_PUBLIC);
4ede5d
 	    if (fields[c] == NULL)
4ede5d
+	      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	      /* coverity[leaked_storage: FALSE] */
4ede5d
 	      return FALSE;
4ede5d
 	    ++c;
4ede5d
 	  }
4ede5d
@@ -1747,6 +1775,8 @@ parse_ieee_ty (struct ieee_info *info, c
4ede5d
     case 'T':
4ede5d
       /* Typedef.  */
4ede5d
       if (! ieee_read_type_index (info, pp, &type))
4ede5d
+	/* There is a potential resource leak here, but it is not important.  */
4ede5d
+	/* coverity[leaked_storage: FALSE] */
4ede5d
 	return FALSE;
4ede5d
       typdef = TRUE;
4ede5d
       break;
4ede5d
@@ -1766,6 +1796,8 @@ parse_ieee_ty (struct ieee_info *info, c
4ede5d
 	if (! ieee_read_number (info, pp, &attr)
4ede5d
 	    || ! ieee_read_type_index (info, pp, &rtype)
4ede5d
 	    || ! ieee_read_number (info, pp, &nargs))
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return FALSE;
4ede5d
 	do
4ede5d
 	  {
4ede5d
@@ -1773,6 +1805,8 @@ parse_ieee_ty (struct ieee_info *info, c
4ede5d
 	    unsigned long namlen;
4ede5d
 
4ede5d
 	    if (! ieee_read_optional_id (info, pp, &name, &namlen, &present))
4ede5d
+	      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	      /* coverity[leaked_storage: FALSE] */
4ede5d
 	      return FALSE;
4ede5d
 	  }
4ede5d
 	while (present);
4ede5d
@@ -1810,6 +1844,8 @@ parse_ieee_ty (struct ieee_info *info, c
4ede5d
 
4ede5d
 	if (! ieee_read_type_index (info, pp, &etype)
4ede5d
 	    || ! ieee_read_number (info, pp, &high))
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return FALSE;
4ede5d
 
4ede5d
 	type = debug_make_array_type (dhandle, etype,
4ede5d
@@ -1829,6 +1865,8 @@ parse_ieee_ty (struct ieee_info *info, c
4ede5d
 	/* FIXME: I don't know what the name means.  */
4ede5d
 
4ede5d
 	if (! ieee_read_id (info, pp, &name, &namlen))
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return FALSE;
4ede5d
 
4ede5d
 	type = debug_make_complex_type (dhandle, tc == 'c' ? 4 : 8);
4ede5d
@@ -1838,6 +1876,8 @@ parse_ieee_ty (struct ieee_info *info, c
4ede5d
     case 'f':
4ede5d
       /* Pascal file name.  FIXME.  */
4ede5d
       ieee_error (info, ty_code_start, _("Pascal file name not supported"));
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
       return FALSE;
4ede5d
 
4ede5d
     case 'g':
4ede5d
@@ -1849,12 +1889,16 @@ parse_ieee_ty (struct ieee_info *info, c
4ede5d
 
4ede5d
 	if (! ieee_read_number (info, pp, &signedp)
4ede5d
 	    || ! ieee_read_number (info, pp, &bitsize))
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return FALSE;
4ede5d
 
4ede5d
 	/* I think the documentation says that there is a type index,
4ede5d
            but some actual files do not have one.  */
4ede5d
 	hold = *pp;
4ede5d
 	if (! ieee_read_optional_number (info, pp, &dummy, &present))
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return FALSE;
4ede5d
 	if (! present)
4ede5d
 	  {
4ede5d
@@ -1866,6 +1910,8 @@ parse_ieee_ty (struct ieee_info *info, c
4ede5d
 	  {
4ede5d
 	    *pp = hold;
4ede5d
 	    if (! ieee_read_type_index (info, pp, &type))
4ede5d
+	      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	      /* coverity[leaked_storage: FALSE] */
4ede5d
 	      return FALSE;
4ede5d
 	  }
4ede5d
 	type_bitsize = bitsize;
4ede5d
@@ -1880,12 +1926,16 @@ parse_ieee_ty (struct ieee_info *info, c
4ede5d
 
4ede5d
 	if (! ieee_read_number (info, pp, &kind)
4ede5d
 	    || ! ieee_read_type_index (info, pp, &t))
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return FALSE;
4ede5d
 
4ede5d
 	switch (kind)
4ede5d
 	  {
4ede5d
 	  default:
4ede5d
 	    ieee_error (info, ty_start, _("unsupported qualifier"));
4ede5d
+	    /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	    /* coverity[leaked_storage: FALSE] */
4ede5d
 	    return FALSE;
4ede5d
 
4ede5d
 	  case 1:
4ede5d
@@ -1907,6 +1957,8 @@ parse_ieee_ty (struct ieee_info *info, c
4ede5d
 
4ede5d
 	if (! ieee_read_number (info, pp, &size)
4ede5d
 	    || ! ieee_read_type_index (info, pp, &etype))
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return FALSE;
4ede5d
 
4ede5d
 	/* FIXME: We ignore the size.  */
4ede5d
@@ -1934,6 +1986,8 @@ parse_ieee_ty (struct ieee_info *info, c
4ede5d
 	    || ! ieee_read_number (info, pp, &push_mask)
4ede5d
 	    || ! ieee_read_type_index (info, pp, &rtype)
4ede5d
 	    || ! ieee_read_number (info, pp, &nargs))
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return FALSE;
4ede5d
 	if (nargs == (bfd_vma) -1)
4ede5d
 	  {
4ede5d
@@ -1948,6 +2002,8 @@ parse_ieee_ty (struct ieee_info *info, c
4ede5d
 			 xmalloc ((nargs + 1) * sizeof *arg_types));
4ede5d
 	    for (i = 0; i < nargs; i++)
4ede5d
 	      if (! ieee_read_type_index (info, pp, arg_types + i))
4ede5d
+		/* There is a potential resource leak here, but it is not important.  */
4ede5d
+		/* coverity[leaked_storage: FALSE] */
4ede5d
 		return FALSE;
4ede5d
 
4ede5d
 	    /* If the last type is pointer to void, this is really a
4ede5d
@@ -1995,6 +2051,8 @@ parse_ieee_ty (struct ieee_info *info, c
4ede5d
 	  }
4ede5d
 	if (! ieee_read_number (info, pp, &level)
4ede5d
 	    || ! ieee_read_optional_number (info, pp, &father, &present))
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return FALSE;
4ede5d
 
4ede5d
 	/* We can't distinguish between a global function and a static
4ede5d
diff -rup binutils.orig/binutils/objcopy.c binutils-2.30/binutils/objcopy.c
4ede5d
--- binutils.orig/binutils/objcopy.c	2019-10-07 17:01:58.036684476 +0100
4ede5d
+++ binutils-2.30/binutils/objcopy.c	2019-10-07 17:26:39.304812562 +0100
4ede5d
@@ -1142,6 +1142,8 @@ add_specific_symbols (const char *filena
4ede5d
       line = eol;
4ede5d
       line_count ++;
4ede5d
     }
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
 }
4ede5d
 
4ede5d
 /* See whether a symbol should be stripped or kept
4ede5d
@@ -1817,6 +1819,8 @@ add_redefine_syms_file (const char *file
4ede5d
     fatal (_("%s:%d: premature end of file"), filename, lineno);
4ede5d
 
4ede5d
   free (buf);
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
 }
4ede5d
 
4ede5d
 /* Copy unknown object file IBFD onto OBFD.
4ede5d
@@ -2855,6 +2859,8 @@ copy_object (bfd *ibfd, bfd *obfd, const
4ede5d
 			     strerror (errno));
4ede5d
 		  free (contents);
4ede5d
 		  return FALSE;
4ede5d
+		  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+		  /* coverity[leaked_storage: FALSE] */
4ede5d
 		}
4ede5d
 	    }
4ede5d
 	  else
4ede5d
@@ -3063,6 +3069,8 @@ copy_object (bfd *ibfd, bfd *obfd, const
4ede5d
 	    {
4ede5d
 	      status = 1;
4ede5d
 	      return FALSE;
4ede5d
+	      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	      /* coverity[leaked_storage: FALSE] */
4ede5d
 	    }
4ede5d
 	}
4ede5d
 
4ede5d
@@ -3097,6 +3105,8 @@ copy_object (bfd *ibfd, bfd *obfd, const
4ede5d
 					  0, padd->size))
4ede5d
 	    {
4ede5d
 	      bfd_nonfatal_message (NULL, obfd, padd->section, NULL);
4ede5d
+	      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	      /* coverity[leaked_storage: FALSE] */
4ede5d
 	      return FALSE;
4ede5d
 	    }
4ede5d
 	}
4ede5d
@@ -3115,6 +3125,8 @@ copy_object (bfd *ibfd, bfd *obfd, const
4ede5d
 					  0, pupdate->size))
4ede5d
 	    {
4ede5d
 	      bfd_nonfatal_message (NULL, obfd, osec, NULL);
4ede5d
+	      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	      /* coverity[leaked_storage: FALSE] */
4ede5d
 	      return FALSE;
4ede5d
 	    }
4ede5d
 	}
4ede5d
@@ -3128,6 +3140,8 @@ copy_object (bfd *ibfd, bfd *obfd, const
4ede5d
 	  if (! bfd_set_section_contents (obfd, osec, merged_notes, 0, merged_size))
4ede5d
 	    {
4ede5d
 	      bfd_nonfatal_message (NULL, obfd, osec, _("error: failed to copy merged notes into output"));
4ede5d
+	      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	      /* coverity[leaked_storage: FALSE] */
4ede5d
 	      return FALSE;
4ede5d
 	    }
4ede5d
 	}
4ede5d
@@ -3146,6 +3160,8 @@ copy_object (bfd *ibfd, bfd *obfd, const
4ede5d
 	  bfd_nonfatal_message (NULL, obfd, NULL,
4ede5d
 				_("cannot fill debug link section `%s'"),
4ede5d
 				gnu_debuglink_filename);
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return FALSE;
4ede5d
 	}
4ede5d
     }
4ede5d
@@ -3184,6 +3200,8 @@ copy_object (bfd *ibfd, bfd *obfd, const
4ede5d
 						  off, now))
4ede5d
 		    {
4ede5d
 		      bfd_nonfatal_message (NULL, obfd, osections[i], NULL);
4ede5d
+		      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+		      /* coverity[leaked_storage: FALSE] */
4ede5d
 		      return FALSE;
4ede5d
 		    }
4ede5d
 
4ede5d
@@ -3202,6 +3220,8 @@ copy_object (bfd *ibfd, bfd *obfd, const
4ede5d
     {
4ede5d
       bfd_nonfatal_message (NULL, obfd, NULL,
4ede5d
 			    _("error copying private BFD data"));
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
       return FALSE;
4ede5d
     }
4ede5d
 
4ede5d
@@ -3224,6 +3244,8 @@ copy_object (bfd *ibfd, bfd *obfd, const
4ede5d
 	}
4ede5d
     }
4ede5d
 
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
   return TRUE;
4ede5d
 }
4ede5d
 
4ede5d
@@ -3302,6 +3324,7 @@ copy_archive (bfd *ibfd, bfd *obfd, cons
4ede5d
       /* If the file already exists, make another temp dir.  */
4ede5d
       if (stat (output_name, &buf) >= 0)
4ede5d
 	{
4ede5d
+	  free (output_name);
4ede5d
 	  output_name = make_tempdir (output_name);
4ede5d
 	  if (output_name == NULL)
4ede5d
 	    {
4ede5d
@@ -3435,6 +3458,7 @@ copy_archive (bfd *ibfd, bfd *obfd, cons
4ede5d
     }
4ede5d
 
4ede5d
   rmdir (dir);
4ede5d
+  free (dir);
4ede5d
 }
4ede5d
 
4ede5d
 static void
4ede5d
@@ -4310,6 +4334,8 @@ write_debugging_info (bfd *obfd, void *d
4ede5d
 	{
4ede5d
 	  bfd_nonfatal_message (NULL, obfd, NULL,
4ede5d
 				_("can't create debugging section"));
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return FALSE;
4ede5d
 	}
4ede5d
 
4ede5d
@@ -4323,6 +4349,8 @@ write_debugging_info (bfd *obfd, void *d
4ede5d
 	{
4ede5d
 	  bfd_nonfatal_message (NULL, obfd, NULL,
4ede5d
 				_("can't set debugging section contents"));
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return FALSE;
4ede5d
 	}
4ede5d
 
4ede5d
@@ -5569,6 +5597,8 @@ copy_main (int argc, char *argv[])
4ede5d
 	}
4ede5d
     }
4ede5d
 
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
   return 0;
4ede5d
 }
4ede5d
 
4ede5d
diff -rup binutils-2.30/binutils/ieee.c binutils.new/binutils/ieee.c
4ede5d
--- binutils-2.30/binutils/ieee.c	2019-10-08 10:20:47.186432611 +0100
4ede5d
+++ binutils.new/binutils/ieee.c	2019-10-08 10:20:33.515525367 +0100
4ede5d
@@ -2661,13 +2661,18 @@ ieee_read_cxx_class (struct ieee_info *i
4ede5d
       spec_start = *pp;
4ede5d
 
4ede5d
       if (! ieee_require_asn (info, pp, &id))
4ede5d
+	/* There is a potential resource leak here, but it is not important.  */
4ede5d
+	/* coverity[leaked_storage: FALSE] */
4ede5d
 	return FALSE;
4ede5d
+
4ede5d
       --count;
4ede5d
 
4ede5d
       switch (id)
4ede5d
 	{
4ede5d
 	default:
4ede5d
 	  ieee_error (info, spec_start, _("unrecognized C++ object spec"));
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return FALSE;
4ede5d
 
4ede5d
 	case 'b':
4ede5d
@@ -2704,6 +2709,8 @@ ieee_read_cxx_class (struct ieee_info *i
4ede5d
 	    if ((fieldlen == 0) == (cinline == 0))
4ede5d
 	      {
4ede5d
 		ieee_error (info, start, _("unsupported C++ object type"));
4ede5d
+		/* There is a potential resource leak here, but it is not important.  */
4ede5d
+		/* coverity[leaked_storage: FALSE] */
4ede5d
 		return FALSE;
4ede5d
 	      }
4ede5d
 
4ede5d
@@ -2887,12 +2894,16 @@ ieee_read_cxx_class (struct ieee_info *i
4ede5d
 		  }
4ede5d
 	      }
4ede5d
 	    if (ftype == DEBUG_TYPE_NULL)
4ede5d
+	      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	      /* coverity[leaked_storage: FALSE] */
4ede5d
 	      return FALSE;
4ede5d
 
4ede5d
 	    switch (flags & CXXFLAGS_VISIBILITY)
4ede5d
 	      {
4ede5d
 	      default:
4ede5d
 		ieee_error (info, start, _("unknown C++ visibility"));
4ede5d
+		/* There is a potential resource leak here, but it is not important.  */
4ede5d
+		/* coverity[leaked_storage: FALSE] */
4ede5d
 		return FALSE;
4ede5d
 
4ede5d
 	      case CXXFLAGS_VISIBILITY_PUBLIC:
4ede5d
@@ -2927,6 +2938,8 @@ ieee_read_cxx_class (struct ieee_info *i
4ede5d
 		if (bitpos == (bfd_vma) -1 || bitsize == (bfd_vma) -1)
4ede5d
 		  {
4ede5d
 		    ieee_error (info, start, _("bad C++ field bit pos or size"));
4ede5d
+		    /* There is a potential resource leak here, but it is not important.  */
4ede5d
+		    /* coverity[leaked_storage: FALSE] */
4ede5d
 		    return FALSE;
4ede5d
 		  }
4ede5d
 		field = debug_make_field (dhandle, fieldcopy, ftype, bitpos,
4ede5d
@@ -3043,6 +3056,8 @@ ieee_read_cxx_class (struct ieee_info *i
4ede5d
 	      {
4ede5d
 	      default:
4ede5d
 		ieee_error (info, start, _("unknown C++ visibility"));
4ede5d
+		/* There is a potential resource leak here, but it is not important.  */
4ede5d
+		/* coverity[leaked_storage: FALSE] */
4ede5d
 		return FALSE;
4ede5d
 
4ede5d
 	      case CXXFLAGS_VISIBILITY_PUBLIC:
4ede5d
@@ -3229,6 +3244,8 @@ ieee_read_cxx_class (struct ieee_info *i
4ede5d
 	  dmethods[i] = debug_make_method (dhandle, namcopy,
4ede5d
 					   methods[i].variants);
4ede5d
 	  if (dmethods[i] == DEBUG_METHOD_NULL)
4ede5d
+	    /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	    /* coverity[leaked_storage: FALSE] */
4ede5d
 	    return FALSE;
4ede5d
 	}
4ede5d
       dmethods[i] = DEBUG_METHOD_NULL;
4ede5d
diff -rup binutils-2.30/binutils/objcopy.c binutils.new/binutils/objcopy.c
4ede5d
--- binutils-2.30/binutils/objcopy.c	2019-10-08 10:20:47.186432611 +0100
4ede5d
+++ binutils.new/binutils/objcopy.c	2019-10-08 10:20:33.513525381 +0100
4ede5d
@@ -2858,9 +2858,9 @@ copy_object (bfd *ibfd, bfd *obfd, const
4ede5d
 			     pdump->filename,
4ede5d
 			     strerror (errno));
4ede5d
 		  free (contents);
4ede5d
-		  return FALSE;
4ede5d
 		  /* There is a potential resource leak here, but it is not important.  */
4ede5d
 		  /* coverity[leaked_storage: FALSE] */
4ede5d
+		  return FALSE;
4ede5d
 		}
4ede5d
 	    }
4ede5d
 	  else
4ede5d
@@ -3068,9 +3068,9 @@ copy_object (bfd *ibfd, bfd *obfd, const
4ede5d
 	  if (bfd_get_error () != bfd_error_no_error)
4ede5d
 	    {
4ede5d
 	      status = 1;
4ede5d
-	      return FALSE;
4ede5d
 	      /* There is a potential resource leak here, but it is not important.  */
4ede5d
 	      /* coverity[leaked_storage: FALSE] */
4ede5d
+	      return FALSE;
4ede5d
 	    }
4ede5d
 	}
4ede5d
 
4ede5d
@@ -3083,6 +3083,8 @@ copy_object (bfd *ibfd, bfd *obfd, const
4ede5d
       if (! write_debugging_info (obfd, dhandle, &symcount, &osympp))
4ede5d
 	{
4ede5d
 	  status = 1;
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return FALSE;
4ede5d
 	}
4ede5d
     }
4ede5d
@@ -3210,6 +3212,8 @@ copy_object (bfd *ibfd, bfd *obfd, const
4ede5d
 		}
4ede5d
 	    }
4ede5d
 	}
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
     }
4ede5d
 
4ede5d
   /* Allow the BFD backend to copy any private data it understands
4ede5d
@@ -3324,8 +3328,10 @@ copy_archive (bfd *ibfd, bfd *obfd, cons
4ede5d
       /* If the file already exists, make another temp dir.  */
4ede5d
       if (stat (output_name, &buf) >= 0)
4ede5d
 	{
4ede5d
+	  char * on;
4ede5d
+	  on = make_tempdir (output_name);
4ede5d
 	  free (output_name);
4ede5d
-	  output_name = make_tempdir (output_name);
4ede5d
+	  output_name = on;
4ede5d
 	  if (output_name == NULL)
4ede5d
 	    {
4ede5d
 	      non_fatal (_("cannot create tempdir for archive copying (error: %s)"),
4ede5d
diff -rup binutils-2.30/binutils/rdcoff.c binutils.new/binutils/rdcoff.c
4ede5d
--- binutils-2.30/binutils/rdcoff.c	2018-01-13 13:31:15.000000000 +0000
4ede5d
+++ binutils.new/binutils/rdcoff.c	2019-10-08 10:20:33.512525387 +0100
4ede5d
@@ -409,6 +409,8 @@ parse_coff_struct_type (bfd *abfd, struc
4ede5d
 	{
4ede5d
 	  non_fatal (_("bfd_coff_get_syment failed: %s"),
4ede5d
 		     bfd_errmsg (bfd_get_error ()));
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return DEBUG_TYPE_NULL;
4ede5d
 	}
4ede5d
 
4ede5d
@@ -425,6 +427,8 @@ parse_coff_struct_type (bfd *abfd, struc
4ede5d
 	    {
4ede5d
 	      non_fatal (_("bfd_coff_get_auxent failed: %s"),
4ede5d
 			 bfd_errmsg (bfd_get_error ()));
4ede5d
+	      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	      /* coverity[leaked_storage: FALSE] */
4ede5d
 	      return DEBUG_TYPE_NULL;
4ede5d
 	    }
4ede5d
 	  psubaux = &auxent;
4ede5d
@@ -514,6 +518,8 @@ parse_coff_enum_type (bfd *abfd, struct
4ede5d
 	{
4ede5d
 	  non_fatal (_("bfd_coff_get_syment failed: %s"),
4ede5d
 		     bfd_errmsg (bfd_get_error ()));
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return DEBUG_TYPE_NULL;
4ede5d
 	}
4ede5d
 
4ede5d
diff -rup binutils-2.30/binutils/readelf.c binutils.new/binutils/readelf.c
4ede5d
--- binutils-2.30/binutils/readelf.c	2019-10-08 10:20:47.161432781 +0100
4ede5d
+++ binutils.new/binutils/readelf.c	2019-10-08 10:20:33.507525422 +0100
4ede5d
@@ -5304,6 +5304,8 @@ get_32bit_section_headers (Filedata * fi
4ede5d
     {
4ede5d
       if (!probe)
4ede5d
 	error (_("Out of memory reading %u section headers\n"), num);
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
       return FALSE;
4ede5d
     }
4ede5d
 
4ede5d
@@ -5370,6 +5372,8 @@ get_64bit_section_headers (Filedata * fi
4ede5d
     {
4ede5d
       if (! probe)
4ede5d
 	error (_("Out of memory reading %u section headers\n"), num);
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
       return FALSE;
4ede5d
     }
4ede5d
 
4ede5d
@@ -5456,6 +5460,7 @@ get_32bit_elf_symbols (Filedata *
4ede5d
     for (entry = symtab_shndx_list; entry != NULL; entry = entry->next)
4ede5d
       if (entry->hdr->sh_link == (unsigned long) (section - filedata->section_headers))
4ede5d
 	{
4ede5d
+	  free (shndx);
4ede5d
 	  shndx = (Elf_External_Sym_Shndx *) get_data (NULL, filedata,
4ede5d
 						       entry->hdr->sh_offset,
4ede5d
 						       1, entry->hdr->sh_size,
4ede5d
@@ -5569,6 +5574,7 @@ get_64bit_elf_symbols (Filedata *
4ede5d
     for (entry = symtab_shndx_list; entry != NULL; entry = entry->next)
4ede5d
       if (entry->hdr->sh_link == (unsigned long) (section - filedata->section_headers))
4ede5d
 	{
4ede5d
+	  free (shndx);
4ede5d
 	  shndx = (Elf_External_Sym_Shndx *) get_data (NULL, filedata,
4ede5d
 						       entry->hdr->sh_offset,
4ede5d
 						       1, entry->hdr->sh_size,
4ede5d
@@ -9647,6 +9653,7 @@ process_dynamic_section (Filedata * file
4ede5d
 	    section.sh_entsize = sizeof (Elf64_External_Sym);
4ede5d
 	  section.sh_name = filedata->string_table_length;
4ede5d
 
4ede5d
+	  free (dynamic_symbols);
4ede5d
 	  dynamic_symbols = GET_ELF_SYMBOLS (filedata, &section, & num_dynamic_syms);
4ede5d
 	  if (num_dynamic_syms < 1)
4ede5d
 	    {
4ede5d
@@ -11500,6 +11507,8 @@ process_symbol_table (Filedata * filedat
4ede5d
 	if (gnubuckets[i] != 0)
4ede5d
 	  {
4ede5d
 	    if (gnubuckets[i] < gnusymidx)
4ede5d
+	      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	      /* coverity[leaked_storage: FALSE] */
4ede5d
 	      return FALSE;
4ede5d
 
4ede5d
 	    if (maxchain == 0xffffffff || gnubuckets[i] > maxchain)
4ede5d
@@ -12950,6 +12959,8 @@ apply_relocations (Filedata *
4ede5d
       symsec = filedata->section_headers + relsec->sh_link;
4ede5d
       if (symsec->sh_type != SHT_SYMTAB
4ede5d
 	  && symsec->sh_type != SHT_DYNSYM)
4ede5d
+	/* There is a potential resource leak here, but it is not important.  */
4ede5d
+	/* coverity[leaked_storage: FALSE] */
4ede5d
 	return FALSE;
4ede5d
       symtab = GET_ELF_SYMBOLS (filedata, symsec, & num_syms);
4ede5d
 
4ede5d
@@ -16096,6 +16107,8 @@ process_mips_specific (Filedata * fileda
4ede5d
 	}
4ede5d
       else
4ede5d
 	res = FALSE;
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
     }
4ede5d
 
4ede5d
   if (conflicts_offset != 0 && conflictsno != 0)
4ede5d
@@ -16133,6 +16146,8 @@ process_mips_specific (Filedata * fileda
4ede5d
               get_data (NULL, filedata, conflicts_offset, conflictsno,
4ede5d
                         sizeof (* econf32), _("conflict"));
4ede5d
 	  if (!econf32)
4ede5d
+	    /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	    /* coverity[leaked_storage: FALSE] */
4ede5d
 	    return FALSE;
4ede5d
 
4ede5d
 	  for (cnt = 0; cnt < conflictsno; ++cnt)
4ede5d
@@ -16148,6 +16163,8 @@ process_mips_specific (Filedata * fileda
4ede5d
               get_data (NULL, filedata, conflicts_offset, conflictsno,
4ede5d
                         sizeof (* econf64), _("conflict"));
4ede5d
 	  if (!econf64)
4ede5d
+	    /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	    /* coverity[leaked_storage: FALSE] */
4ede5d
 	    return FALSE;
4ede5d
 
4ede5d
 	  for (cnt = 0; cnt < conflictsno; ++cnt)
4ede5d
@@ -16350,6 +16367,8 @@ process_mips_specific (Filedata * fileda
4ede5d
       data = (unsigned char *) get_data (NULL, filedata, offset, end - mips_pltgot,
4ede5d
                                          1, _("Procedure Linkage Table data"));
4ede5d
       if (data == NULL)
4ede5d
+	/* There is a potential resource leak here, but it is not important.  */
4ede5d
+	/* coverity[leaked_storage: FALSE] */
4ede5d
 	return FALSE;
4ede5d
 
4ede5d
       printf ("\nPLT GOT:\n\n");
4ede5d
@@ -16434,6 +16453,8 @@ process_nds32_specific (Filedata * filed
4ede5d
 	  printf ("(VEC_SIZE):\treserved\n");
4ede5d
 	  break;
4ede5d
 	}
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
     }
4ede5d
 
4ede5d
   return TRUE;
4ede5d
@@ -17488,9 +17509,9 @@ get_symbol_for_build_attribute (Filedata
4ede5d
 				const char **    pname)
4ede5d
 {
4ede5d
   static Filedata *         saved_filedata = NULL;
4ede5d
-  static char *             strtab;
4ede5d
+  static char *             strtab = NULL;
4ede5d
   static unsigned long      strtablen;
4ede5d
-  static Elf_Internal_Sym * symtab;
4ede5d
+  static Elf_Internal_Sym * symtab = NULL;
4ede5d
   static unsigned long      nsyms;
4ede5d
   Elf_Internal_Sym *        saved_sym = NULL;
4ede5d
   Elf_Internal_Sym *        sym;
4ede5d
@@ -17507,12 +17528,14 @@ get_symbol_for_build_attribute (Filedata
4ede5d
 	{
4ede5d
 	  if (symsec->sh_type == SHT_SYMTAB)
4ede5d
 	    {
4ede5d
+	      free (symtab);
4ede5d
 	      symtab = GET_ELF_SYMBOLS (filedata, symsec, & nsyms);
4ede5d
 
4ede5d
 	      if (symsec->sh_link < filedata->file_header.e_shnum)
4ede5d
 		{
4ede5d
 		  Elf_Internal_Shdr * strtab_sec = filedata->section_headers + symsec->sh_link;
4ede5d
 
4ede5d
+		  free (strtab);
4ede5d
 		  strtab = (char *) get_data (NULL, filedata, strtab_sec->sh_offset,
4ede5d
 					      1, strtab_sec->sh_size,
4ede5d
 					      _("string table"));
4ede5d
@@ -18095,6 +18118,8 @@ process_notes_at (Filedata *           f
4ede5d
     {
4ede5d
       warn (_("Corrupt note: alignment %ld, expecting 4 or 8\n"),
4ede5d
 	    (long) align);
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
       return FALSE;
4ede5d
     }
4ede5d
 
4ede5d
diff -rup binutils.orig/binutils/ieee.c binutils-2.30/binutils/ieee.c
4ede5d
--- binutils.orig/binutils/ieee.c	2019-10-08 11:33:02.620958088 +0100
4ede5d
+++ binutils-2.30/binutils/ieee.c	2019-10-08 11:34:44.609294479 +0100
4ede5d
@@ -2838,6 +2838,8 @@ ieee_read_cxx_class (struct ieee_info *i
4ede5d
 		if (structfields == NULL)
4ede5d
 		  {
4ede5d
 		    ieee_error (info, start, _("C++ object has no fields"));
4ede5d
+		    /* There is a potential resource leak here, but it is not important.  */
4ede5d
+		    /* coverity[leaked_storage: FALSE] */
4ede5d
 		    return FALSE;
4ede5d
 		  }
4ede5d
 
4ede5d
diff -rup binutils.orig/binutils/rddbg.c binutils-2.30/binutils/rddbg.c
4ede5d
--- binutils.orig/binutils/rddbg.c	2019-10-08 11:33:02.619958094 +0100
4ede5d
+++ binutils-2.30/binutils/rddbg.c	2019-10-08 11:34:35.169355901 +0100
4ede5d
@@ -86,6 +86,8 @@ read_debugging_info (bfd *abfd, asymbol
4ede5d
       if (! no_messages)
4ede5d
 	non_fatal (_("%s: no recognized debugging information"),
4ede5d
 		   bfd_get_filename (abfd));
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
       return NULL;
4ede5d
     }
4ede5d
 
4ede5d
@@ -300,6 +302,8 @@ read_symbol_stabs_debugging_info (bfd *a
4ede5d
 
4ede5d
 	  s = i.name;
4ede5d
 	  if (s == NULL || strlen (s) < 1)
4ede5d
+	    /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	    /* coverity[leaked_storage: FALSE] */
4ede5d
 	    return FALSE;
4ede5d
 	  f = NULL;
4ede5d
 
4ede5d
diff -rup binutils.orig/binutils/stabs.c binutils-2.30/binutils/stabs.c
4ede5d
--- binutils.orig/binutils/stabs.c	2019-10-08 11:33:02.607958173 +0100
4ede5d
+++ binutils-2.30/binutils/stabs.c	2019-10-08 11:34:25.489418884 +0100
4ede5d
@@ -758,6 +758,8 @@ parse_stab_string (void *dhandle, struct
4ede5d
       if (*p != '=')
4ede5d
 	{
4ede5d
 	  bad_stab (string);
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return FALSE;
4ede5d
 	}
4ede5d
       ++p;
4ede5d
@@ -791,6 +793,8 @@ parse_stab_string (void *dhandle, struct
4ede5d
 	  if (*p != ',')
4ede5d
 	    {
4ede5d
 	      bad_stab (string);
4ede5d
+	      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	      /* coverity[leaked_storage: FALSE] */
4ede5d
 	      return FALSE;
4ede5d
 	    }
4ede5d
 	  if (! debug_record_typed_const (dhandle, name, dtype, atoi (p)))
4ede5d
@@ -798,6 +802,8 @@ parse_stab_string (void *dhandle, struct
4ede5d
 	  break;
4ede5d
 	default:
4ede5d
 	  bad_stab (string);
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return FALSE;
4ede5d
 	}
4ede5d
 
4ede5d
@@ -810,6 +816,8 @@ parse_stab_string (void *dhandle, struct
4ede5d
       if (dtype == DEBUG_TYPE_NULL)
4ede5d
 	return FALSE;
4ede5d
       if (! debug_record_label (dhandle, name, dtype, value))
4ede5d
+	/* There is a potential resource leak here, but it is not important.  */
4ede5d
+	/* coverity[leaked_storage: FALSE] */
4ede5d
 	return FALSE;
4ede5d
       break;
4ede5d
 
4ede5d
@@ -1114,6 +1122,8 @@ parse_stab_string (void *dhandle, struct
4ede5d
 	  while (*p != ';')
4ede5d
 	    ++p;
4ede5d
 	  ++p;
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return TRUE;
4ede5d
 	}
4ede5d
       /* TODO SUNPro C++ support:
4ede5d
@@ -1127,12 +1137,16 @@ parse_stab_string (void *dhandle, struct
4ede5d
 
4ede5d
     default:
4ede5d
       bad_stab (string);
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
       return FALSE;
4ede5d
     }
4ede5d
 
4ede5d
   /* FIXME: gdb converts structure values to structure pointers in a
4ede5d
      couple of cases, depending upon the target.  */
4ede5d
 
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
   return TRUE;
4ede5d
 }
4ede5d
 
4ede5d
@@ -1499,6 +1513,8 @@ parse_stab_type (void *dhandle, struct s
4ede5d
 	      if (**pp != ',')
4ede5d
 		{
4ede5d
 		  bad_stab (orig);
4ede5d
+		  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+		  /* coverity[leaked_storage: FALSE] */
4ede5d
 		  return DEBUG_TYPE_NULL;
4ede5d
 		}
4ede5d
 	      ++*pp;
4ede5d
@@ -1513,6 +1529,8 @@ parse_stab_type (void *dhandle, struct s
4ede5d
 	      args[n] = parse_stab_type (dhandle, info, (const char *) NULL,
4ede5d
 					 pp, (debug_type **) NULL);
4ede5d
 	      if (args[n] == DEBUG_TYPE_NULL)
4ede5d
+		/* There is a potential resource leak here, but it is not important.  */
4ede5d
+		/* coverity[leaked_storage: FALSE] */
4ede5d
 		return DEBUG_TYPE_NULL;
4ede5d
 	      ++n;
4ede5d
 	    }
4ede5d
@@ -2290,6 +2308,8 @@ parse_stab_struct_fields (void *dhandle,
4ede5d
 
4ede5d
       if (! parse_stab_one_struct_field (dhandle, info, pp, p, fields + c,
4ede5d
 					 staticsp))
4ede5d
+	/* There is a potential resource leak here, but it is not important.  */
4ede5d
+	/* coverity[leaked_storage: FALSE] */
4ede5d
 	return FALSE;
4ede5d
 
4ede5d
       ++c;
4ede5d
@@ -2365,6 +2385,8 @@ parse_stab_cpp_abbrev (void *dhandle, st
4ede5d
   if (**pp != ':')
4ede5d
     {
4ede5d
       bad_stab (orig);
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
       return FALSE;
4ede5d
     }
4ede5d
   ++*pp;
4ede5d
@@ -2374,6 +2396,8 @@ parse_stab_cpp_abbrev (void *dhandle, st
4ede5d
   if (**pp != ',')
4ede5d
     {
4ede5d
       bad_stab (orig);
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
       return FALSE;
4ede5d
     }
4ede5d
   ++*pp;
4ede5d
@@ -2382,6 +2406,8 @@ parse_stab_cpp_abbrev (void *dhandle, st
4ede5d
   if (**pp != ';')
4ede5d
     {
4ede5d
       bad_stab (orig);
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
       return FALSE;
4ede5d
     }
4ede5d
   ++*pp;
4ede5d
@@ -2787,6 +2813,8 @@ parse_stab_members (void *dhandle, struc
4ede5d
 	      if (return_type == DEBUG_TYPE_NULL)
4ede5d
 		{
4ede5d
 		  bad_stab (orig);
4ede5d
+		  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+		  /* coverity[leaked_storage: FALSE] */
4ede5d
 		  goto fail;
4ede5d
 		}
4ede5d
 	      type = parse_stab_argtypes (dhandle, info, class_type, name,
4ede5d
@@ -3104,6 +3132,8 @@ parse_stab_array_type (void *dhandle, st
4ede5d
   if (**pp != ';')
4ede5d
     {
4ede5d
       bad_stab (orig);
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
       return DEBUG_TYPE_NULL;
4ede5d
     }
4ede5d
   ++*pp;
4ede5d
@@ -3120,6 +3150,8 @@ parse_stab_array_type (void *dhandle, st
4ede5d
   if (**pp != ';')
4ede5d
     {
4ede5d
       bad_stab (orig);
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
       return DEBUG_TYPE_NULL;
4ede5d
     }
4ede5d
   ++*pp;
4ede5d
@@ -3134,6 +3166,8 @@ parse_stab_array_type (void *dhandle, st
4ede5d
   if (**pp != ';')
4ede5d
     {
4ede5d
       bad_stab (orig);
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
       return DEBUG_TYPE_NULL;
4ede5d
     }
4ede5d
   ++*pp;
4ede5d
@@ -3141,6 +3175,8 @@ parse_stab_array_type (void *dhandle, st
4ede5d
   element_type = parse_stab_type (dhandle, info, (const char *) NULL, pp,
4ede5d
 				  (debug_type **) NULL);
4ede5d
   if (element_type == DEBUG_TYPE_NULL)
4ede5d
+    /* There is a potential resource leak here, but it is not important.  */
4ede5d
+    /* coverity[leaked_storage: FALSE] */
4ede5d
     return DEBUG_TYPE_NULL;
4ede5d
 
4ede5d
   if (adjustable)
4ede5d
@@ -5366,6 +5402,8 @@ stab_demangle_v3_arg (void *dhandle, str
4ede5d
 					  dc->u.s_binary.right,
4ede5d
 					  &varargs);
4ede5d
 	if (pargs == NULL)
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return NULL;
4ede5d
 
4ede5d
 	return debug_make_function_type (dhandle, dt, pargs, varargs);
4ede5d
diff -rup binutils.orig/gas/as.c binutils-2.30/gas/as.c
4ede5d
--- binutils.orig/gas/as.c	2019-10-08 11:33:02.834956696 +0100
4ede5d
+++ binutils-2.30/gas/as.c	2019-10-08 11:34:17.073473644 +0100
4ede5d
@@ -934,6 +934,8 @@ This program has absolutely no warranty.
4ede5d
  	case OPTION_AL:
4ede5d
 	  listing |= LISTING_LISTING;
4ede5d
 	  if (optarg)
4ede5d
+	    /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	    /* coverity[leaked_storage: FALSE] */
4ede5d
 	    listing_filename = xstrdup (optarg);
4ede5d
 	  break;
4ede5d
 
4ede5d
@@ -988,6 +990,8 @@ This program has absolutely no warranty.
4ede5d
 		      listing |= LISTING_SYMBOLS;
4ede5d
 		      break;
4ede5d
 		    case '=':
4ede5d
+		      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+		      /* coverity[leaked_storage: FALSE] */
4ede5d
 		      listing_filename = xstrdup (optarg + 1);
4ede5d
 		      optarg += strlen (listing_filename);
4ede5d
 		      break;
4ede5d
@@ -1021,6 +1025,8 @@ This program has absolutely no warranty.
4ede5d
 	  }
4ede5d
 
4ede5d
 	case 'o':
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  out_file_name = xstrdup (optarg);
4ede5d
 	  break;
4ede5d
 
4ede5d
diff -rup binutils.orig/gas/config/obj-elf.c binutils-2.30/gas/config/obj-elf.c
4ede5d
--- binutils.orig/gas/config/obj-elf.c	2019-10-08 11:33:02.848956604 +0100
4ede5d
+++ binutils-2.30/gas/config/obj-elf.c	2019-10-08 11:34:09.473523094 +0100
4ede5d
@@ -1028,6 +1028,8 @@ obj_elf_attach_to_group (int dummy ATTRI
4ede5d
 
4ede5d
   elf_group_name (now_seg) = xstrdup (gname);
4ede5d
   elf_section_flags (now_seg) |= SHF_GROUP;
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
 }
4ede5d
 
4ede5d
 void
4ede5d
@@ -1103,6 +1105,8 @@ obj_elf_section (int push)
4ede5d
 	  if (beg == NULL)
4ede5d
 	    {
4ede5d
 	      ignore_rest_of_line ();
4ede5d
+	      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	      /* coverity[leaked_storage: FALSE] */
4ede5d
 	      return;
4ede5d
 	    }
4ede5d
 	  attr |= obj_elf_parse_section_letters (beg, strlen (beg), &is_clone);
4ede5d
@@ -1233,6 +1237,8 @@ obj_elf_section (int push)
4ede5d
 		{
4ede5d
 		  as_bad (_("character following name is not '#'"));
4ede5d
 		  ignore_rest_of_line ();
4ede5d
+		  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+		  /* coverity[leaked_storage: FALSE] */
4ede5d
 		  return;
4ede5d
 		}
4ede5d
 	      ++input_line_pointer;
4ede5d
diff -rup binutils.orig/gas/dwarf2dbg.c binutils-2.30/gas/dwarf2dbg.c
4ede5d
--- binutils.orig/gas/dwarf2dbg.c	2019-10-08 11:33:02.839956663 +0100
4ede5d
+++ binutils-2.30/gas/dwarf2dbg.c	2019-10-08 11:34:00.913578791 +0100
4ede5d
@@ -1701,6 +1701,8 @@ out_file_list (void)
4ede5d
 
4ede5d
   /* Terminate filename list.  */
4ede5d
   out_byte (0);
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
 }
4ede5d
 
4ede5d
 /* Switch to SEC and output a header length field.  Return the size of
4ede5d
@@ -2115,6 +2117,8 @@ out_debug_str (segT str_seg, symbolS **n
4ede5d
   len = strlen (producer) + 1;
4ede5d
   p = frag_more (len);
4ede5d
   memcpy (p, producer, len);
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
 }
4ede5d
 
4ede5d
 void
4ede5d
diff -rup binutils.orig/gas/read.c binutils-2.30/gas/read.c
4ede5d
--- binutils.orig/gas/read.c	2019-10-08 11:33:02.852956578 +0100
4ede5d
+++ binutils-2.30/gas/read.c	2019-10-08 11:33:51.537639797 +0100
4ede5d
@@ -1714,6 +1714,8 @@ read_symbol_name (void)
4ede5d
     {
4ede5d
       as_bad (_("expected symbol name"));
4ede5d
       ignore_rest_of_line ();
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
       return NULL;
4ede5d
     }
4ede5d
 
4ede5d
diff -rup binutils.orig/gas/write.c binutils-2.30/gas/write.c
4ede5d
--- binutils.orig/gas/write.c	2019-10-08 11:33:02.833956702 +0100
4ede5d
+++ binutils-2.30/gas/write.c	2019-10-08 11:33:36.033740679 +0100
4ede5d
@@ -1366,6 +1366,8 @@ write_relocs (bfd *abfd, asection *sec,
4ede5d
       }
4ede5d
   }
4ede5d
 #endif
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
 }
4ede5d
 
4ede5d
 static int
4ede5d
@@ -1868,6 +1870,8 @@ create_note_reloc (segT           sec,
4ede5d
   if (reloc->u.b.r.howto == NULL)
4ede5d
     {
4ede5d
       as_bad (_("unable to create reloc for build note"));
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
       return;
4ede5d
     }
4ede5d
 
4ede5d
diff -rup binutils.orig/gas/as.c binutils-2.30/gas/as.c
4ede5d
--- binutils.orig/gas/as.c	2019-10-08 13:45:17.382428420 +0100
4ede5d
+++ binutils-2.30/gas/as.c	2019-10-08 13:46:01.613135558 +0100
4ede5d
@@ -935,7 +935,7 @@ This program has absolutely no warranty.
4ede5d
 	  listing |= LISTING_LISTING;
4ede5d
 	  if (optarg)
4ede5d
 	    /* There is a potential resource leak here, but it is not important.  */
4ede5d
-	    /* coverity[leaked_storage: FALSE] */
4ede5d
+	    /* coverity[overwrite_var: FALSE] */
4ede5d
 	    listing_filename = xstrdup (optarg);
4ede5d
 	  break;
4ede5d
 
4ede5d
@@ -991,7 +991,7 @@ This program has absolutely no warranty.
4ede5d
 		      break;
4ede5d
 		    case '=':
4ede5d
 		      /* There is a potential resource leak here, but it is not important.  */
4ede5d
-		      /* coverity[leaked_storage: FALSE] */
4ede5d
+		      /* coverity[overwrite_var: FALSE] */
4ede5d
 		      listing_filename = xstrdup (optarg + 1);
4ede5d
 		      optarg += strlen (listing_filename);
4ede5d
 		      break;
4ede5d
@@ -1026,7 +1026,7 @@ This program has absolutely no warranty.
4ede5d
 
4ede5d
 	case 'o':
4ede5d
 	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
-	  /* coverity[leaked_storage: FALSE] */
4ede5d
+	  /* coverity[overwrite_var: FALSE] */
4ede5d
 	  out_file_name = xstrdup (optarg);
4ede5d
 	  break;
4ede5d
 
4ede5d
diff -rup binutils.orig/gas/config/obj-elf.c binutils-2.30/gas/config/obj-elf.c
4ede5d
--- binutils.orig/gas/config/obj-elf.c	2019-10-08 13:45:17.371428492 +0100
4ede5d
+++ binutils-2.30/gas/config/obj-elf.c	2019-10-08 13:46:49.916815725 +0100
4ede5d
@@ -1023,6 +1023,8 @@ obj_elf_attach_to_group (int dummy ATTRI
4ede5d
   if (elf_group_name (now_seg))
4ede5d
     {
4ede5d
       as_warn ("already has a group");
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
       return;
4ede5d
     }
4ede5d
 
4ede5d
diff -rup binutils.orig/gas/dwarf2dbg.c binutils-2.30/gas/dwarf2dbg.c
4ede5d
--- binutils.orig/gas/dwarf2dbg.c	2019-10-08 13:45:17.384428407 +0100
4ede5d
+++ binutils-2.30/gas/dwarf2dbg.c	2019-10-08 13:47:29.198555634 +0100
4ede5d
@@ -1664,6 +1664,8 @@ out_file_list (void)
4ede5d
   /* Emit directory list.  */
4ede5d
   for (i = 1; i < dirs_in_use; ++i)
4ede5d
     {
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[overwrite_var: FALSE] */
4ede5d
       dir = remap_debug_filename (dirs[i]);
4ede5d
       size = strlen (dir) + 1;
4ede5d
       cp = frag_more (size);
4ede5d
diff -rup binutils.orig/gold/cref.cc binutils-2.30/gold/cref.cc
4ede5d
--- binutils.orig/gold/cref.cc	2019-10-08 13:45:17.653426626 +0100
4ede5d
+++ binutils-2.30/gold/cref.cc	2019-10-08 13:47:46.669439951 +0100
4ede5d
@@ -391,6 +391,8 @@ Cref::print_symbol_counts(const Symbol_t
4ede5d
 	}
4ede5d
       if (f != NULL)
4ede5d
 	this->inputs_->print_symbol_counts(symtab, f);
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
     }
4ede5d
 }
4ede5d
 
4ede5d
diff -rup binutils.orig/gold/dwarf_reader.cc binutils-2.30/gold/dwarf_reader.cc
4ede5d
--- binutils.orig/gold/dwarf_reader.cc	2019-10-08 13:45:17.654426619 +0100
4ede5d
+++ binutils-2.30/gold/dwarf_reader.cc	2019-10-08 13:48:03.292329889 +0100
4ede5d
@@ -265,12 +265,16 @@ Dwarf_abbrev_table::do_get_abbrev(unsign
4ede5d
 	{
4ede5d
 	  // Read the attribute.
4ede5d
 	  if (this->buffer_pos_ >= this->buffer_end_)
4ede5d
+	    /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	    /* coverity[leaked_storage: FALSE] */
4ede5d
 	    return NULL;
4ede5d
 	  uint64_t attr = read_unsigned_LEB_128(this->buffer_pos_, &len;;
4ede5d
 	  this->buffer_pos_ += len;
4ede5d
 
4ede5d
 	  // Read the form.
4ede5d
 	  if (this->buffer_pos_ >= this->buffer_end_)
4ede5d
+	    /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	    /* coverity[leaked_storage: FALSE] */
4ede5d
 	    return NULL;
4ede5d
 	  uint64_t form = read_unsigned_LEB_128(this->buffer_pos_, &len;;
4ede5d
 	  this->buffer_pos_ += len;
4ede5d
diff -rup binutils.orig/gold/dwp.cc binutils-2.30/gold/dwp.cc
4ede5d
--- binutils.orig/gold/dwp.cc	2019-10-08 13:45:17.656426606 +0100
4ede5d
+++ binutils-2.30/gold/dwp.cc	2019-10-08 13:48:12.317270132 +0100
4ede5d
@@ -803,6 +803,8 @@ Sized_relobj_dwo<size, big_endian>::setu
4ede5d
 	  pshdrs, this->shnum(), names, section_names_size, this, true);
4ede5d
   if (compressed_sections != NULL && !compressed_sections->empty())
4ede5d
     this->set_compressed_sections(compressed_sections);
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
 }
4ede5d
 
4ede5d
 // Return a view of the contents of a section.
4ede5d
@@ -1163,6 +1165,8 @@ Dwo_file::sized_read_unit_index(unsigned
4ede5d
       elfcpp::Swap_unaligned<32, big_endian>::readval(contents
4ede5d
 						      + 2 * sizeof(uint32_t));
4ede5d
   if (ncols == 0 || nused == 0)
4ede5d
+    /* There is a potential resource leak here, but it is not important.  */
4ede5d
+    /* coverity[leaked_storage: FALSE] */
4ede5d
     return;
4ede5d
 
4ede5d
   gold_assert(info_shndx > 0);
4ede5d
@@ -1305,6 +1309,8 @@ Dwo_file::sized_verify_dwo_list(unsigned
4ede5d
       elfcpp::Swap_unaligned<32, big_endian>::readval(contents
4ede5d
 						      + 2 * sizeof(uint32_t));
4ede5d
   if (ncols == 0 || nused == 0)
4ede5d
+    /* There is a potential resource leak here, but it is not important.  */
4ede5d
+    /* coverity[leaked_storage: FALSE] */
4ede5d
     return true;
4ede5d
 
4ede5d
   unsigned int nslots =
4ede5d
diff -rup binutils.orig/gold/ehframe.cc binutils-2.30/gold/ehframe.cc
4ede5d
--- binutils.orig/gold/ehframe.cc	2019-10-08 13:45:17.653426626 +0100
4ede5d
+++ binutils-2.30/gold/ehframe.cc	2019-10-08 13:48:21.580208800 +0100
4ede5d
@@ -1187,6 +1187,8 @@ Eh_frame::remove_ehframe_for_plt(Output_
4ede5d
 
4ede5d
   if (this->mappings_are_done_)
4ede5d
     this->final_data_size_ -= align_address(fde_length + 8, this->addralign());
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
 }
4ede5d
 
4ede5d
 // Return the number of FDEs.
4ede5d
diff -rup binutils.orig/gold/fileread.cc binutils-2.30/gold/fileread.cc
4ede5d
--- binutils.orig/gold/fileread.cc	2019-10-08 13:45:17.657426599 +0100
4ede5d
+++ binutils-2.30/gold/fileread.cc	2019-10-08 13:48:33.645128913 +0100
4ede5d
@@ -873,6 +873,8 @@ File_view::~File_view()
4ede5d
 Input_file::Input_file(const char* name)
4ede5d
   : found_name_(), file_(), is_in_sysroot_(false), format_(FORMAT_NONE)
4ede5d
 {
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[ctor_dtor_leak: FALSE] */
4ede5d
   this->input_argument_ =
4ede5d
     new Input_file_argument(name, Input_file_argument::INPUT_FILE_TYPE_FILE,
4ede5d
 			    "", false, Position_dependent_options());
4ede5d
@@ -884,6 +886,8 @@ Input_file::Input_file(const Task* task,
4ede5d
 		       const unsigned char* contents, off_t size)
4ede5d
   : file_()
4ede5d
 {
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[ctor_dtor_leak: FALSE] */
4ede5d
   this->input_argument_ =
4ede5d
     new Input_file_argument(name, Input_file_argument::INPUT_FILE_TYPE_FILE,
4ede5d
 			    "", false, Position_dependent_options());
4ede5d
diff -rup binutils.orig/gold/gdb-index.cc binutils-2.30/gold/gdb-index.cc
4ede5d
--- binutils.orig/gold/gdb-index.cc	2019-10-08 13:45:17.656426606 +0100
4ede5d
+++ binutils-2.30/gold/gdb-index.cc	2019-10-08 13:48:46.061046705 +0100
4ede5d
@@ -1043,6 +1043,8 @@ Gdb_index::map_pubtable_to_dies(unsigned
4ede5d
 
4ede5d
   map->clear();
4ede5d
   if (!table->read_section(object, symbols, symbols_size))
4ede5d
+    /* There is a potential resource leak here, but it is not important.  */
4ede5d
+    /* coverity[leaked_storage: FALSE] */
4ede5d
     return NULL;
4ede5d
 
4ede5d
   while (table->read_header(section_offset))
4ede5d
diff -rup binutils.orig/gold/gold.cc binutils-2.30/gold/gold.cc
4ede5d
--- binutils.orig/gold/gold.cc	2019-10-08 13:45:17.656426606 +0100
4ede5d
+++ binutils-2.30/gold/gold.cc	2019-10-08 13:48:57.387971709 +0100
4ede5d
@@ -349,6 +349,8 @@ process_incremental_input(Incremental_bi
4ede5d
       // Incremental_binary::check_inputs should have cancelled the
4ede5d
       // incremental update if the script has changed.
4ede5d
       gold_assert(!ibase->file_has_changed(input_file_index));
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
       return new Check_script(layout, ibase, input_file_index, input_reader,
4ede5d
 			      this_blocker, next_blocker);
4ede5d
     }
4ede5d
@@ -362,6 +364,8 @@ process_incremental_input(Incremental_bi
4ede5d
 	{
4ede5d
 	  // Queue a task to check that no references have been added to any
4ede5d
 	  // of the library's unused symbols.
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return new Check_library(symtab, layout, ibase, input_file_index,
4ede5d
 				   input_reader, this_blocker, next_blocker);
4ede5d
 	}
4ede5d
@@ -384,6 +388,8 @@ process_incremental_input(Incremental_bi
4ede5d
 	{
4ede5d
 	  if (ibase->file_has_changed(lib->input_file_index()))
4ede5d
 	    {
4ede5d
+	      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	      /* coverity[leaked_storage: FALSE] */
4ede5d
 	      return new Read_member(input_objects, symtab, layout, mapfile,
4ede5d
 				     input_reader, this_blocker, next_blocker);
4ede5d
 	    }
4ede5d
diff -rup binutils.orig/gold/layout.cc binutils-2.30/gold/layout.cc
4ede5d
--- binutils.orig/gold/layout.cc	2019-10-08 13:45:17.654426619 +0100
4ede5d
+++ binutils-2.30/gold/layout.cc	2019-10-08 13:49:09.579890984 +0100
4ede5d
@@ -487,6 +487,8 @@ Layout::Layout(int number_of_input_files
4ede5d
 
4ede5d
   // Initialize structure needed for an incremental build.
4ede5d
   if (parameters->incremental())
4ede5d
+    /* There is a potential resource leak here, but it is not important.  */
4ede5d
+    /* coverity[ctor_dtor_leak: FALSE] */
4ede5d
     this->incremental_inputs_ = new Incremental_inputs;
4ede5d
 
4ede5d
   // The section name pool is worth optimizing in all cases, because
4ede5d
@@ -3239,6 +3241,8 @@ Layout::create_note(const char* name, in
4ede5d
 						   flags, false, order, false,
4ede5d
 						   false, true);
4ede5d
   if (os == NULL)
4ede5d
+    /* There is a potential resource leak here, but it is not important.  */
4ede5d
+    /* coverity[leaked_storage: FALSE] */
4ede5d
     return NULL;
4ede5d
 
4ede5d
   Output_section_data* posd = new Output_data_const_buffer(buffer, notehdrsz,
4ede5d
@@ -3301,6 +3305,8 @@ Layout::create_gnu_properties_note()
4ede5d
     }
4ede5d
   Output_section_data* posd = new Output_data_const(desc, descsz, 4);
4ede5d
   os->add_output_section_data(posd);
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
 }
4ede5d
 
4ede5d
 // For an executable or shared library, create a note to record the
4ede5d
@@ -4790,6 +4796,8 @@ Layout::create_dynamic_symtab(const Inpu
4ede5d
 
4ede5d
 	  if (odyn != NULL)
4ede5d
 	    odyn->add_section_address(elfcpp::DT_GNU_HASH, hashsec);
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	}
4ede5d
     }
4ede5d
 
4ede5d
@@ -4824,6 +4832,8 @@ Layout::create_dynamic_symtab(const Inpu
4ede5d
 
4ede5d
       if (odyn != NULL)
4ede5d
 	odyn->add_section_address(elfcpp::DT_HASH, hashsec);
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
     }
4ede5d
 }
4ede5d
 
4ede5d
@@ -5030,6 +5040,8 @@ Layout::create_interp(const Target* targ
4ede5d
 						     false, false, false);
4ede5d
   if (osec != NULL)
4ede5d
     osec->add_output_section_data(odata);
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
 }
4ede5d
 
4ede5d
 // Add dynamic tags for the PLT and the dynamic relocs.  This is
4ede5d
diff -rup binutils.orig/gold/object.cc binutils-2.30/gold/object.cc
4ede5d
--- binutils.orig/gold/object.cc	2019-10-08 13:45:17.669426519 +0100
4ede5d
+++ binutils-2.30/gold/object.cc	2019-10-08 13:49:36.027715869 +0100
4ede5d
@@ -896,6 +896,8 @@ Sized_relobj_file<size, big_endian>::bas
4ede5d
   if (strtab_shndx >= this->shnum())
4ede5d
     {
4ede5d
       this->error(_("invalid symbol table name index: %u"), strtab_shndx);
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
       return;
4ede5d
     }
4ede5d
   typename This::Shdr strtabshdr(pshdrs + strtab_shndx * This::shdr_size);
4ede5d
@@ -903,6 +905,8 @@ Sized_relobj_file<size, big_endian>::bas
4ede5d
     {
4ede5d
       this->error(_("symbol table name section has wrong type: %u"),
4ede5d
 		  static_cast<unsigned int>(strtabshdr.get_sh_type()));
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
       return;
4ede5d
     }
4ede5d
 
4ede5d
diff -rup binutils.orig/gold/output.cc binutils-2.30/gold/output.cc
4ede5d
--- binutils.orig/gold/output.cc	2019-10-08 13:45:17.655426612 +0100
4ede5d
+++ binutils-2.30/gold/output.cc	2019-10-08 13:49:48.571632811 +0100
4ede5d
@@ -2392,6 +2392,8 @@ Output_section::Output_section(const cha
4ede5d
     extra_segment_flags_(0),
4ede5d
     segment_alignment_(0),
4ede5d
     checkpoint_(NULL),
4ede5d
+    /* There is a potential resource leak here, but it is not important.  */
4ede5d
+    /* coverity[ctor_dtor_leak: FALSE] */
4ede5d
     lookup_maps_(new Output_section_lookup_maps),
4ede5d
     free_list_(),
4ede5d
     free_space_fill_(NULL),
4ede5d
diff -rup binutils.orig/gold/plugin.cc binutils-2.30/gold/plugin.cc
4ede5d
--- binutils.orig/gold/plugin.cc	2019-10-08 13:45:17.669426519 +0100
4ede5d
+++ binutils-2.30/gold/plugin.cc	2019-10-08 13:49:58.427567551 +0100
4ede5d
@@ -1919,6 +1919,8 @@ unique_segment_for_sections(const char*
4ede5d
       Object* obj = parameters->options().plugins()->get_elf_object(
4ede5d
           section_list[i].handle);
4ede5d
       if (obj == NULL || obj->is_dynamic())
4ede5d
+	/* There is a potential resource leak here, but it is not important.  */
4ede5d
+	/* coverity[leaked_storage: FALSE] */
4ede5d
 	return LDPS_BAD_HANDLE;
4ede5d
       unsigned int shndx = section_list[i].shndx;
4ede5d
       Const_section_id secn_id(static_cast<Relobj*>(obj), shndx);
4ede5d
diff -rup binutils.orig/gold/readsyms.cc binutils-2.30/gold/readsyms.cc
4ede5d
--- binutils.orig/gold/readsyms.cc	2019-10-08 13:45:17.656426606 +0100
4ede5d
+++ binutils-2.30/gold/readsyms.cc	2019-10-08 13:50:09.964491164 +0100
4ede5d
@@ -274,6 +274,8 @@ Read_symbols::do_read_symbols(Workqueue*
4ede5d
 
4ede5d
   Input_file* input_file = new Input_file(&this->input_argument_->file());
4ede5d
   if (!input_file->open(*this->dirpath_, this, &this->dirindex_))
4ede5d
+    /* There is a potential resource leak here, but it is not important.  */
4ede5d
+    /* coverity[leaked_storage: FALSE] */
4ede5d
     return false;
4ede5d
 
4ede5d
   // Read enough of the file to pick up the entire ELF header.
4ede5d
diff -rup binutils.orig/gold/script.cc binutils-2.30/gold/script.cc
4ede5d
--- binutils.orig/gold/script.cc	2019-10-08 13:45:17.652426632 +0100
4ede5d
+++ binutils-2.30/gold/script.cc	2019-10-08 13:50:19.708426645 +0100
4ede5d
@@ -2844,6 +2844,8 @@ script_parse_option(void* closurev, cons
4ede5d
       // The General_options class will quite possibly store a pointer
4ede5d
       // into mutable_option, so we can't free it.  In cases the class
4ede5d
       // does not store such a pointer, this is a memory leak.  Alas. :(
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
     }
4ede5d
   closure->clear_skip_on_incompatible_target();
4ede5d
 }
4ede5d
diff -rup binutils.orig/gold/workqueue.cc binutils-2.30/gold/workqueue.cc
4ede5d
--- binutils.orig/gold/workqueue.cc	2019-10-08 13:45:17.655426612 +0100
4ede5d
+++ binutils-2.30/gold/workqueue.cc	2019-10-08 13:50:28.076371238 +0100
4ede5d
@@ -130,6 +130,8 @@ Workqueue::Workqueue(const General_optio
4ede5d
   threads = false;
4ede5d
 #endif
4ede5d
   if (!threads)
4ede5d
+    /* There is a potential resource leak here, but it is not important.  */
4ede5d
+    /* coverity[ctor_dtor_leak: FALSE] */
4ede5d
     this->threader_ = new Workqueue_threader_single(this);
4ede5d
   else
4ede5d
     {
4ede5d
diff -rup binutils.orig/gprof/cg_print.c binutils-2.30/gprof/cg_print.c
4ede5d
--- binutils.orig/gprof/cg_print.c	2019-10-08 13:45:17.127430108 +0100
4ede5d
+++ binutils-2.30/gprof/cg_print.c	2019-10-08 13:50:40.732287437 +0100
4ede5d
@@ -1287,4 +1287,6 @@ cg_print_file_ordering (void)
4ede5d
 	printf ("%s\n", symbol_map[sym_index].file_name);
4ede5d
       last = symbol_map[sym_index].file_name;
4ede5d
     }
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
 }
4ede5d
diff -rup binutils.orig/gold/gold.cc binutils-2.30/gold/gold.cc
4ede5d
--- binutils.orig/gold/gold.cc	2019-10-08 14:45:28.076504486 +0100
4ede5d
+++ binutils-2.30/gold/gold.cc	2019-10-08 14:45:47.877373236 +0100
4ede5d
@@ -221,6 +221,8 @@ queue_initial_tasks(const General_option
4ede5d
 	  else
4ede5d
 	    gold_fallback(_("restart link with --incremental-full"));
4ede5d
 	}
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
     }
4ede5d
 
4ede5d
   // Read the input files.  We have to add the symbols to the symbol
4ede5d
diff -rup binutils.orig/gprof/gmon_io.c binutils-2.30/gprof/gmon_io.c
4ede5d
--- binutils.orig/gprof/gmon_io.c	2019-10-08 14:45:27.582507760 +0100
4ede5d
+++ binutils-2.30/gprof/gmon_io.c	2019-10-08 14:46:22.454144044 +0100
4ede5d
@@ -749,4 +749,6 @@ gmon_out_write (const char *filename)
4ede5d
 	       whoami, file_format);
4ede5d
       done (1);
4ede5d
     }
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
 }
4ede5d
diff -rup binutils.orig/gprof/source.c binutils-2.30/gprof/source.c
4ede5d
--- binutils.orig/gprof/source.c	2019-10-08 14:45:27.583507753 +0100
4ede5d
+++ binutils-2.30/gprof/source.c	2019-10-08 14:46:33.925068010 +0100
4ede5d
@@ -216,6 +216,8 @@ annotate_source (Source_File *sf, unsign
4ede5d
       if (!ofp)
4ede5d
 	{
4ede5d
 	  perror (fname);
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return 0;
4ede5d
 	}
4ede5d
     }
4ede5d
diff -rup binutils.orig/ld/emultempl/elf32.em binutils-2.30/ld/emultempl/elf32.em
4ede5d
--- binutils.orig/ld/emultempl/elf32.em	2019-10-08 14:45:27.638507389 +0100
4ede5d
+++ binutils-2.30/ld/emultempl/elf32.em	2019-10-08 14:47:40.916623958 +0100
4ede5d
@@ -1776,6 +1776,9 @@ gld${EMULATION_NAME}_before_allocation (
4ede5d
 		if (cp != NULL && *cp != '\0')
4ede5d
 		  gld${EMULATION_NAME}_append_to_separated_string (&depaudit, cp);
4ede5d
 
4ede5d
+		/* There is a potential resource leak here, but it is not important.  */
4ede5d
+		/* coverity[overwrite_var: FALSE] */
4ede5d
+		/* coverity[leaked_storage: FALSE] */
4ede5d
 		cp = more ? ++cp2 : NULL;
4ede5d
 	      }
4ede5d
 	    while (cp != NULL);
4ede5d
diff -rup binutils.orig/ld/emultempl/pe.em binutils-2.30/ld/emultempl/pe.em
4ede5d
--- binutils.orig/ld/emultempl/pe.em	2019-10-08 14:45:27.637507396 +0100
4ede5d
+++ binutils-2.30/ld/emultempl/pe.em	2019-10-08 14:48:22.133350756 +0100
4ede5d
@@ -1371,6 +1371,8 @@ write_build_id (bfd *abfd)
4ede5d
     return 0;
4ede5d
 
4ede5d
   if (bfd_bwrite (contents, size, abfd) != size)
4ede5d
+    /* There is a potential resource leak here, but it is not important.  */
4ede5d
+    /* coverity[leaked_storage: FALSE] */
4ede5d
     return 0;
4ede5d
 
4ede5d
   /* Construct the CodeView record.  */
4ede5d
diff -rup binutils.orig/ld/emultempl/pep.em binutils-2.30/ld/emultempl/pep.em
4ede5d
--- binutils.orig/ld/emultempl/pep.em	2019-10-08 14:45:27.638507389 +0100
4ede5d
+++ binutils-2.30/ld/emultempl/pep.em	2019-10-08 14:48:42.356216712 +0100
4ede5d
@@ -1338,6 +1338,8 @@ write_build_id (bfd *abfd)
4ede5d
     return 0;
4ede5d
 
4ede5d
   if (bfd_bwrite (contents, size, abfd) != size)
4ede5d
+    /* There is a potential resource leak here, but it is not important.  */
4ede5d
+    /* coverity[leaked_storage: FALSE] */
4ede5d
     return 0;
4ede5d
 
4ede5d
   /* Construct the CodeView record.  */
4ede5d
diff -rup binutils.orig/ld/ldfile.c binutils-2.30/ld/ldfile.c
4ede5d
--- binutils.orig/ld/ldfile.c	2019-10-08 14:45:27.635507409 +0100
4ede5d
+++ binutils-2.30/ld/ldfile.c	2019-10-08 14:49:24.851935030 +0100
4ede5d
@@ -563,6 +563,8 @@ ldfile_find_command_file (const char *na
4ede5d
 	  ldfile_add_library_path (script_dir, TRUE);
4ede5d
 	  search_tail_ptr = save_tail_ptr;
4ede5d
 	}
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
     }
4ede5d
 
4ede5d
   /* Temporarily append script_search to the path list so that the
4ede5d
diff -rup binutils.orig/ld/ldlang.c binutils-2.30/ld/ldlang.c
4ede5d
--- binutils.orig/ld/ldlang.c	2019-10-08 14:45:27.638507389 +0100
4ede5d
+++ binutils-2.30/ld/ldlang.c	2019-10-08 14:49:37.283852627 +0100
4ede5d
@@ -9272,6 +9272,8 @@ cmdline_fopen_temp (const char *path, co
4ede5d
   fd = open (tmpname, O_RDWR | O_CREAT | O_EXCL, 0600);
4ede5d
 #endif
4ede5d
   if (fd == -1)
4ede5d
+    /* There is a potential resource leak here, but it is not important.  */
4ede5d
+    /* coverity[leaked_storage: FALSE] */
4ede5d
     return NULL;
4ede5d
   return bfd_fopen (tmpname, target, mode, fd);
4ede5d
 }
4ede5d
diff -rup binutils.orig/ld/ldmain.c binutils-2.30/ld/ldmain.c
4ede5d
--- binutils.orig/ld/ldmain.c	2019-10-08 14:45:27.650507310 +0100
4ede5d
+++ binutils-2.30/ld/ldmain.c	2019-10-08 14:52:26.130733447 +0100
4ede5d
@@ -802,6 +802,8 @@ add_archive_element (struct bfd_link_inf
4ede5d
 		info_msg ("%I: no new IR symbols to claimi\n",
4ede5d
 			  &orig_input);
4ede5d
 	      input->flags.claimed = 0;
4ede5d
+	      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	      /* coverity[leaked_storage: FALSE] */
4ede5d
 	      return FALSE;
4ede5d
 	    }
4ede5d
 	  input->flags.claim_archive = TRUE;
4ede5d
@@ -855,6 +857,8 @@ add_archive_element (struct bfd_link_inf
4ede5d
 	  header_printed = TRUE;
4ede5d
 	}
4ede5d
 
4ede5d
+      /* Coverity incorrectly believes that abfd might be NULL at this point.  */
4ede5d
+      /* coverity[deref_after_free: FALSE] */
4ede5d
       if (abfd->my_archive == NULL
4ede5d
 	  || bfd_is_thin_archive (abfd->my_archive))
4ede5d
 	{
4ede5d
diff -rup binutils.orig/ld/ldwrite.c binutils-2.30/ld/ldwrite.c
4ede5d
--- binutils.orig/ld/ldwrite.c	2019-10-08 14:45:27.635507409 +0100
4ede5d
+++ binutils-2.30/ld/ldwrite.c	2019-10-08 14:53:32.850291467 +0100
4ede5d
@@ -367,6 +367,8 @@ clone_section (bfd *abfd, asection *s, c
4ede5d
 	{
4ede5d
 	  einfo (_ ("%F%P: cannot create split section name for %s\n"), name);
4ede5d
 	  /* Silence gcc warnings.  einfo exits, so we never reach here.  */
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return NULL;
4ede5d
 	}
4ede5d
       tname[5] = 0;
4ede5d
@@ -379,6 +381,8 @@ clone_section (bfd *abfd, asection *s, c
4ede5d
     {
4ede5d
       einfo (_("%F%P: clone section failed: %E\n"));
4ede5d
       /* Silence gcc warnings.  einfo exits, so we never reach here.  */
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
       return NULL;
4ede5d
     }
4ede5d
   free (tname);
4ede5d
diff -rup binutils.orig/ld/pe-dll.c binutils-2.30/ld/pe-dll.c
4ede5d
--- binutils.orig/ld/pe-dll.c	2019-10-08 14:45:27.650507310 +0100
4ede5d
+++ binutils-2.30/ld/pe-dll.c	2019-10-08 14:54:58.385725320 +0100
4ede5d
@@ -1397,6 +1397,8 @@ generate_reloc (bfd *abfd, struct bfd_li
4ede5d
 	  if (!bfd_generic_link_read_symbols (b))
4ede5d
 	    {
4ede5d
 	      einfo (_("%B%F: could not read symbols: %E\n"), b);
4ede5d
+	      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	      /* coverity[leaked_storage: FALSE] */
4ede5d
 	      return;
4ede5d
 	    }
4ede5d
 
4ede5d
@@ -1585,6 +1587,8 @@ generate_reloc (bfd *abfd, struct bfd_li
4ede5d
 
4ede5d
   while (reloc_sz < reloc_s->size)
4ede5d
     reloc_d[reloc_sz++] = 0;
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
 }
4ede5d
 
4ede5d
 /* Given the exiting def_file structure, print out a .DEF file that
4ede5d
@@ -2043,6 +2047,8 @@ make_tail (bfd *parent)
4ede5d
   bfd_set_section_contents (abfd, id7, d7, 0, len);
4ede5d
 
4ede5d
   bfd_make_readable (abfd);
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
   return abfd;
4ede5d
 }
4ede5d
 
4ede5d
@@ -2323,6 +2329,8 @@ make_one (def_file_export *exp, bfd *par
4ede5d
     bfd_set_section_contents (abfd, id6, d6, 0, len);
4ede5d
 
4ede5d
   bfd_make_readable (abfd);
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
   return abfd;
4ede5d
 }
4ede5d
 
4ede5d
@@ -2364,6 +2372,8 @@ make_singleton_name_imp (const char *imp
4ede5d
   bfd_set_section_contents (abfd, id5, d5, 0, PE_IDATA4_SIZE * 2);
4ede5d
 
4ede5d
   bfd_make_readable (abfd);
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
   return abfd;
4ede5d
 }
4ede5d
 
4ede5d
@@ -2406,6 +2416,8 @@ make_singleton_name_thunk (const char *i
4ede5d
   bfd_set_section_contents (abfd, id4, d4, 0, PE_IDATA4_SIZE * 2);
4ede5d
 
4ede5d
   bfd_make_readable (abfd);
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
   return abfd;
4ede5d
 }
4ede5d
 
4ede5d
@@ -2491,6 +2503,8 @@ make_import_fixup_entry (const char *nam
4ede5d
   bfd_set_section_contents (abfd, id2, d2, 0, 20);
4ede5d
 
4ede5d
   bfd_make_readable (abfd);
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
   return abfd;
4ede5d
 }
4ede5d
 
4ede5d
diff -rup binutils.orig/ld/pe-dll.c binutils-2.30/ld/pe-dll.c
4ede5d
--- binutils.orig/ld/pe-dll.c	2019-10-08 15:28:31.546363527 +0100
4ede5d
+++ binutils-2.30/ld/pe-dll.c	2019-10-08 15:28:46.677262539 +0100
4ede5d
@@ -1977,6 +1977,8 @@ make_head (bfd *parent)
4ede5d
     }
4ede5d
 
4ede5d
   bfd_make_readable (abfd);
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
   return abfd;
4ede5d
 }
4ede5d
 
4ede5d
@@ -2590,6 +2592,8 @@ make_runtime_pseudo_reloc (const char *n
4ede5d
       bfd_set_section_contents (abfd, rt_rel, rt_rel_d, 0, 8);
4ede5d
    }
4ede5d
   bfd_make_readable (abfd);
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
   return abfd;
4ede5d
 }
4ede5d
 
4ede5d
@@ -2634,6 +2638,8 @@ pe_create_runtime_relocator_reference (b
4ede5d
   bfd_set_section_contents (abfd, extern_rt_rel, extern_rt_rel_d, 0, PE_IDATA5_SIZE);
4ede5d
 
4ede5d
   bfd_make_readable (abfd);
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
   return abfd;
4ede5d
 }
4ede5d
 
4ede5d
diff -rup binutils.orig/ld/plugin.c binutils-2.30/ld/plugin.c
4ede5d
--- binutils.orig/ld/plugin.c	2019-10-08 15:28:31.560363434 +0100
4ede5d
+++ binutils-2.30/ld/plugin.c	2019-10-08 15:29:32.579956181 +0100
4ede5d
@@ -314,6 +314,8 @@ plugin_get_ir_dummy_bfd (const char *nam
4ede5d
 
4ede5d
   bfd_use_reserved_id = 1;
4ede5d
   bfd_plugin_target = bfd_plugin_target_p (srctemplate->xvec);
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
   abfd = bfd_create (concat (name, IRONLY_SUFFIX, (const char *) NULL),
4ede5d
 		     bfd_plugin_target ? link_info.output_bfd : srctemplate);
4ede5d
   if (abfd != NULL)
4ede5d
@@ -503,6 +505,8 @@ add_symbols (void *handle, int nsyms, co
4ede5d
       symptrs[n] = bfdsym;
4ede5d
       rv = asymbol_from_plugin_symbol (abfd, bfdsym, syms + n);
4ede5d
       if (rv != LDPS_OK)
4ede5d
+	/* There is a potential resource leak here, but it is not important.  */
4ede5d
+	/* coverity[leaked_storage: FALSE] */
4ede5d
 	return rv;
4ede5d
     }
4ede5d
   bfd_set_symtab (abfd, symptrs, nsyms);
4ede5d
@@ -842,6 +846,8 @@ static enum ld_plugin_status
4ede5d
 set_extra_library_path (const char *path)
4ede5d
 {
4ede5d
   ASSERT (called_plugin);
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[leaked_storage: FALSE] */
4ede5d
   ldfile_add_library_path (xstrdup (path), FALSE);
4ede5d
   return LDPS_OK;
4ede5d
 }
4ede5d
diff -rup binutils.orig/ld/testplug2.c binutils-2.30/ld/testplug2.c
4ede5d
--- binutils.orig/ld/testplug2.c	2019-10-08 15:28:31.547363520 +0100
4ede5d
+++ binutils-2.30/ld/testplug2.c	2019-10-08 15:31:08.483316106 +0100
4ede5d
@@ -242,7 +242,7 @@ parse_symdefstr (const char *str, struct
4ede5d
     sym->version = NULL;
4ede5d
   if (colon5 && colon5[1])
4ede5d
     {
4ede5d
-      sym->comdat_key = malloc (strlen (colon5 + 1) + 1);
4ede5d
+      sym->comdat_key = malloc (strlen (colon5) + 1 + 1);
4ede5d
       if (!sym->comdat_key)
4ede5d
 	return LDPS_ERR;
4ede5d
       strcpy (sym->comdat_key, colon5 + 1);
4ede5d
diff -rup binutils.orig/ld/testplug3.c binutils-2.30/ld/testplug3.c
4ede5d
--- binutils.orig/ld/testplug3.c	2019-10-08 15:28:31.561363427 +0100
4ede5d
+++ binutils-2.30/ld/testplug3.c	2019-10-08 15:31:28.351183504 +0100
4ede5d
@@ -241,7 +241,7 @@ parse_symdefstr (const char *str, struct
4ede5d
     sym->version = NULL;
4ede5d
   if (colon5 && colon5[1])
4ede5d
     {
4ede5d
-      sym->comdat_key = malloc (strlen (colon5 + 1) + 1);
4ede5d
+      sym->comdat_key = malloc (strlen (colon5) + 1 + 1);
4ede5d
       if (!sym->comdat_key)
4ede5d
 	return LDPS_ERR;
4ede5d
       strcpy (sym->comdat_key, colon5 + 1);
4ede5d
diff -rup binutils.orig/ld/testplug4.c binutils-2.30/ld/testplug4.c
4ede5d
--- binutils.orig/ld/testplug4.c	2019-10-08 15:28:31.547363520 +0100
4ede5d
+++ binutils-2.30/ld/testplug4.c	2019-10-08 15:31:38.739114175 +0100
4ede5d
@@ -242,7 +242,7 @@ parse_symdefstr (const char *str, struct
4ede5d
     sym->version = NULL;
4ede5d
   if (colon5 && colon5[1])
4ede5d
     {
4ede5d
-      sym->comdat_key = malloc (strlen (colon5 + 1) + 1);
4ede5d
+      sym->comdat_key = malloc (strlen (colon5) + 1 + 1);
4ede5d
       if (!sym->comdat_key)
4ede5d
 	return LDPS_ERR;
4ede5d
       strcpy (sym->comdat_key, colon5 + 1);
4ede5d
diff -rup binutils.orig/ld/testplug.c binutils-2.30/ld/testplug.c
4ede5d
--- binutils.orig/ld/testplug.c	2019-10-08 15:28:31.560363434 +0100
4ede5d
+++ binutils-2.30/ld/testplug.c	2019-10-08 15:30:37.140525299 +0100
4ede5d
@@ -263,7 +263,7 @@ parse_symdefstr (const char *str, struct
4ede5d
     sym->version = NULL;
4ede5d
   if (colon5 && colon5[1])
4ede5d
     {
4ede5d
-      sym->comdat_key = malloc (strlen (colon5 + 1) + 1);
4ede5d
+      sym->comdat_key = malloc (strlen (colon5) + 1 + 1);
4ede5d
       if (!sym->comdat_key)
4ede5d
 	return LDPS_ERR;
4ede5d
       strcpy (sym->comdat_key, colon5 + 1);
4ede5d
@@ -564,6 +564,8 @@ onclaim_file (const struct ld_plugin_inp
4ede5d
       if (buffer == NULL)
4ede5d
         return LDPS_ERR;
4ede5d
       if (read (file->fd, buffer, bytes_to_read_before_claim) < 0)
4ede5d
+	/* There is a potential resource leak here, but it is not important.  */
4ede5d
+	/* coverity[leaked_storage: FALSE] */
4ede5d
         return LDPS_ERR;
4ede5d
       free (buffer);
4ede5d
     }
4ede5d
diff -rup binutils.orig/libiberty/argv.c binutils-2.30/libiberty/argv.c
4ede5d
--- binutils.orig/libiberty/argv.c	2019-10-08 15:28:32.008360444 +0100
4ede5d
+++ binutils-2.30/libiberty/argv.c	2019-10-08 15:32:06.258930502 +0100
4ede5d
@@ -477,6 +477,8 @@ expandargv (int *argcp, char ***argvp)
4ede5d
     error:
4ede5d
       /* We're all done with the file now.  */
4ede5d
       fclose (f);
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[leaked_storage: FALSE] */
4ede5d
     }
4ede5d
 }
4ede5d
 
4ede5d
diff -rup binutils.orig/libiberty/regex.c binutils-2.30/libiberty/regex.c
4ede5d
--- binutils.orig/libiberty/regex.c	2019-10-08 15:28:32.009360437 +0100
4ede5d
+++ binutils-2.30/libiberty/regex.c	2019-10-08 15:33:10.899499081 +0100
4ede5d
@@ -2453,6 +2453,8 @@ PREFIX(regex_compile) (const char *ARG_P
4ede5d
   /* Loop through the uncompiled pattern until we're at the end.  */
4ede5d
   while (p != pend)
4ede5d
     {
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[memleak: FALSE] */
4ede5d
       PATFETCH (c);
4ede5d
 
4ede5d
       switch (c)
4ede5d
diff -rup binutils.orig/libiberty/simple-object-elf.c binutils-2.30/libiberty/simple-object-elf.c
4ede5d
--- binutils.orig/libiberty/simple-object-elf.c	2019-10-08 15:28:32.011360423 +0100
4ede5d
+++ binutils-2.30/libiberty/simple-object-elf.c	2019-10-08 15:33:40.483301634 +0100
4ede5d
@@ -1151,6 +1151,8 @@ simple_object_elf_copy_lto_debug_section
4ede5d
 	  *err = 0;
4ede5d
 	  XDELETEVEC (names);
4ede5d
 	  XDELETEVEC (shdrs);
4ede5d
+	  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	  /* coverity[leaked_storage: FALSE] */
4ede5d
 	  return "ELF section name out of range";
4ede5d
 	}
4ede5d
 
4ede5d
diff -rup binutils.orig/libiberty/simple-object-mach-o.c binutils-2.30/libiberty/simple-object-mach-o.c
4ede5d
--- binutils.orig/libiberty/simple-object-mach-o.c	2019-10-08 15:28:32.008360444 +0100
4ede5d
+++ binutils-2.30/libiberty/simple-object-mach-o.c	2019-10-08 15:34:16.530061049 +0100
4ede5d
@@ -1139,6 +1139,8 @@ simple_object_mach_o_write_segment (simp
4ede5d
 	    write = sizeof zeroes;
4ede5d
 	  if (!simple_object_internal_write (descriptor, offset, zeroes, write,
4ede5d
 					     errmsg, err))
4ede5d
+	    /* There is a potential resource leak here, but it is not important.  */
4ede5d
+	    /* coverity[leaked_storage: FALSE] */
4ede5d
 	    return 0;
4ede5d
 	  offset += write;
4ede5d
 	}
4ede5d
@@ -1245,6 +1247,8 @@ simple_object_mach_o_write_segment (simp
4ede5d
       if (!simple_object_internal_write (descriptor, offset,
4ede5d
 					 (const unsigned char *) snames,
4ede5d
 					 name_offset, errmsg, err))
4ede5d
+	/* There is a potential resource leak here, but it is not important.  */
4ede5d
+	/* coverity[leaked_storage: FALSE] */
4ede5d
 	return 0;
4ede5d
 
4ede5d
       sechdr_offset += sechdrsize;
4ede5d
diff -rup binutils.orig/libiberty/vprintf-support.c binutils-2.30/libiberty/vprintf-support.c
4ede5d
--- binutils.orig/libiberty/vprintf-support.c	2019-10-08 15:28:32.008360444 +0100
4ede5d
+++ binutils-2.30/libiberty/vprintf-support.c	2019-10-08 15:35:10.785698942 +0100
4ede5d
@@ -49,6 +49,8 @@ libiberty_vprintf_buffer_size (const cha
4ede5d
 #ifdef va_copy
4ede5d
   va_copy (ap, args);
4ede5d
 #else
4ede5d
+  /* There is a potential resource leak here, but it is not important.  */
4ede5d
+  /* coverity[va_list_usedBeforeStarted: FALSE] */
4ede5d
   memcpy ((PTR) &ap, (PTR) &args, sizeof (va_list));
4ede5d
 #endif
4ede5d
 
4ede5d
diff -rup binutils.orig/libiberty/regex.c binutils-2.30/libiberty/regex.c
4ede5d
--- binutils.orig/libiberty/regex.c	2019-10-08 16:19:10.299014643 +0100
4ede5d
+++ binutils-2.30/libiberty/regex.c	2019-10-08 16:20:19.168553441 +0100
4ede5d
@@ -2454,7 +2454,7 @@ PREFIX(regex_compile) (const char *ARG_P
4ede5d
   while (p != pend)
4ede5d
     {
4ede5d
       /* There is a potential resource leak here, but it is not important.  */
4ede5d
-      /* coverity[memleak: FALSE] */
4ede5d
+      /* coverity[error[memleak]: FALSE] */
4ede5d
       PATFETCH (c);
4ede5d
 
4ede5d
       switch (c)
4ede5d
diff -rup binutils.orig/libiberty/vprintf-support.c binutils-2.30/libiberty/vprintf-support.c
4ede5d
--- binutils.orig/libiberty/vprintf-support.c	2019-10-08 16:19:10.299014643 +0100
4ede5d
+++ binutils-2.30/libiberty/vprintf-support.c	2019-10-08 16:24:37.917821604 +0100
4ede5d
@@ -49,8 +49,8 @@ libiberty_vprintf_buffer_size (const cha
4ede5d
 #ifdef va_copy
4ede5d
   va_copy (ap, args);
4ede5d
 #else
4ede5d
-  /* There is a potential resource leak here, but it is not important.  */
4ede5d
-  /* coverity[va_list_usedBeforeStarted: FALSE] */
4ede5d
+  /* Coverity insists on va_start being used.  */
4ede5d
+  va_start (ap);
4ede5d
   memcpy ((PTR) &ap, (PTR) &args, sizeof (va_list));
4ede5d
 #endif
4ede5d
 
4ede5d
diff -rup binutils.orig/zlib/gzlib.c binutils-2.30/zlib/gzlib.c
4ede5d
--- binutils.orig/zlib/gzlib.c	2019-10-08 16:19:10.304014609 +0100
4ede5d
+++ binutils-2.30/zlib/gzlib.c	2019-10-08 16:23:11.678398812 +0100
4ede5d
@@ -291,7 +291,9 @@ gzFile ZEXPORT gzdopen(fd, mode)
4ede5d
     gzFile gz;
4ede5d
 
4ede5d
     if (fd == -1 || (path = (char *)malloc(7 + 3 * sizeof(int))) == NULL)
4ede5d
-        return NULL;
4ede5d
+      /* There is a potential resource leak here, but it is not important.  */
4ede5d
+      /* coverity[Memory Leak: FALSE] */
4ede5d
+      return NULL;
4ede5d
 #if !defined(NO_snprintf) && !defined(NO_vsnprintf)
4ede5d
     (void)snprintf(path, 7 + 3 * sizeof(int), "<fd:%d>", fd);
4ede5d
 #else
4ede5d
diff -rup binutils.orig/libiberty/regex.c binutils-2.30/libiberty/regex.c
4ede5d
--- binutils.orig/libiberty/regex.c	2019-10-08 17:18:32.431500412 +0100
4ede5d
+++ binutils-2.30/libiberty/regex.c	2019-10-08 17:26:31.013117409 +0100
4ede5d
@@ -2453,8 +2453,13 @@ PREFIX(regex_compile) (const char *ARG_P
4ede5d
   /* Loop through the uncompiled pattern until we're at the end.  */
4ede5d
   while (p != pend)
4ede5d
     {
4ede5d
-      /* There is a potential resource leak here, but it is not important.  */
4ede5d
-      /* coverity[error[memleak]: FALSE] */
4ede5d
+      if (p == pend)
4ede5d
+	{
4ede5d
+	  /* This free is to silence coverity.  */
4ede5d
+	  free (compile_stack.stack);
4ede5d
+	  compile_stack.stack = NULL;
4ede5d
+	  compile_stack.avail = 0;
4ede5d
+	}
4ede5d
       PATFETCH (c);
4ede5d
 
4ede5d
       switch (c)
4ede5d
diff -rup binutils.orig/zlib/gzlib.c binutils-2.30/zlib/gzlib.c
4ede5d
--- binutils.orig/zlib/gzlib.c	2019-10-08 17:18:32.435500384 +0100
4ede5d
+++ binutils-2.30/zlib/gzlib.c	2019-10-08 17:20:23.718713753 +0100
4ede5d
@@ -287,13 +287,15 @@ gzFile ZEXPORT gzdopen(fd, mode)
4ede5d
     int fd;
4ede5d
     const char *mode;
4ede5d
 {
4ede5d
-    char *path;         /* identifier for error messages */
4ede5d
+    char *path = NULL;         /* identifier for error messages */
4ede5d
     gzFile gz;
4ede5d
 
4ede5d
     if (fd == -1 || (path = (char *)malloc(7 + 3 * sizeof(int))) == NULL)
4ede5d
-      /* There is a potential resource leak here, but it is not important.  */
4ede5d
-      /* coverity[Memory Leak: FALSE] */
4ede5d
-      return NULL;
4ede5d
+      {
4ede5d
+	/* This free is to silence coverity.  */
4ede5d
+	free (path);
4ede5d
+	return NULL;
4ede5d
+      }
4ede5d
 #if !defined(NO_snprintf) && !defined(NO_vsnprintf)
4ede5d
     (void)snprintf(path, 7 + 3 * sizeof(int), "<fd:%d>", fd);
4ede5d
 #else