Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [patch] bfd: plug memory leak
@ 2007-06-28 21:42 msnyder
  2007-06-28 21:59 ` Daniel Jacobowitz
  0 siblings, 1 reply; 4+ messages in thread
From: msnyder @ 2007-06-28 21:42 UTC (permalink / raw)
  To: gdb-patches

[-- Attachment #1: Type: text/plain, Size: 22 bytes --]

Flagged by Coverity,


[-- Attachment #2: demangle --]
[-- Type: application/octet-stream, Size: 950 bytes --]

2007-06-28  Michael Snyder  <msnyder@svkmacdonelllnx>

	* bfd.c (bfd_demangle): Plug memory leak (Coverity).

Index: bfd.c
===================================================================
RCS file: /cvs/src/src/bfd/bfd.c,v
retrieving revision 1.94
diff -p -r1.94 bfd.c
*** bfd.c	27 Jun 2007 11:54:09 -0000	1.94
--- bfd.c	28 Jun 2007 21:10:30 -0000
*************** bfd_demangle (bfd *abfd, const char *nam
*** 1774,1780 ****
        suf_len = strlen (suf) + 1;
        final = bfd_malloc (pre_len + len + suf_len);
        if (final == NULL)
! 	return NULL;
  
        memcpy (final, pre, pre_len);
        memcpy (final + pre_len, res, len);
--- 1774,1784 ----
        suf_len = strlen (suf) + 1;
        final = bfd_malloc (pre_len + len + suf_len);
        if (final == NULL)
! 	{
! 	  /* Free res before returning!  */
! 	  free (res);
! 	  return NULL;
! 	}
  
        memcpy (final, pre, pre_len);
        memcpy (final + pre_len, res, len);

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-06-28 22:42 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-06-28 21:42 [patch] bfd: plug memory leak msnyder
2007-06-28 21:59 ` Daniel Jacobowitz
2007-06-28 22:17   ` msnyder
2007-06-28 22:43     ` Daniel Jacobowitz

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox