Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: dje@google.com (Doug Evans)
To: gdb-patches@sourceware.org
Subject: [obv] fix memory leaks in gdbserver
Date: Thu, 07 May 2009 23:29:00 -0000	[thread overview]
Message-ID: <20090507232939.4C0DB84890@localhost> (raw)

Hi.

Checked in under the obvious rule.

2009-05-07  Doug Evans  <dje@google.com>

	* linux-low.c (regsets_fetch_inferior_registers): Fix memory leak.
	(regsets_store_inferior_registers): Ditto.

Index: linux-low.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/linux-low.c,v
retrieving revision 1.99
diff -u -p -u -p -r1.99 linux-low.c
--- linux-low.c	6 May 2009 17:32:59 -0000	1.99
+++ linux-low.c	7 May 2009 23:23:35 -0000
@@ -2092,6 +2092,7 @@ regsets_fetch_inferior_registers ()
 	      /* If we get EIO on a regset, do not try it again for
 		 this process.  */
 	      disabled_regsets[regset - target_regsets] = 1;
+	      free (buf);
 	      continue;
 	    }
 	  else
@@ -2106,6 +2107,7 @@ regsets_fetch_inferior_registers ()
 	saw_general_regs = 1;
       regset->store_function (buf);
       regset ++;
+      free (buf);
     }
   if (saw_general_regs)
     return 0;
@@ -2165,6 +2167,7 @@ regsets_store_inferior_registers ()
 	      /* If we get EIO on a regset, do not try it again for
 		 this process.  */
 	      disabled_regsets[regset - target_regsets] = 1;
+	      free (buf);
 	      continue;
 	    }
 	  else if (errno == ESRCH)
@@ -2173,6 +2176,7 @@ regsets_store_inferior_registers ()
 		 already gone, in which case we simply ignore attempts
 		 to change its registers.  See also the related
 		 comment in linux_resume_one_lwp.  */
+	      free (buf);
 	      return 0;
 	    }
 	  else


                 reply	other threads:[~2009-05-07 23:29 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20090507232939.4C0DB84890@localhost \
    --to=dje@google.com \
    --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