Blame SOURCES/binutils-coverity-fixes.patch

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