Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: msnyder@sonic.net
To: gdb-patches@sourceware.org
Subject: [patch] bfd: plug memory leak
Date: Thu, 28 Jun 2007 21:42:00 -0000	[thread overview]
Message-ID: <23820.12.7.175.2.1183065142.squirrel@webmail.sonic.net> (raw)

[-- 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);

             reply	other threads:[~2007-06-28 21:12 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-28 21:42 msnyder [this message]
2007-06-28 21:59 ` Daniel Jacobowitz
2007-06-28 22:17   ` msnyder
2007-06-28 22:43     ` Daniel Jacobowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=23820.12.7.175.2.1183065142.squirrel@webmail.sonic.net \
    --to=msnyder@sonic.net \
    --cc=gdb-patches@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox