This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[obv] fix memory leaks in gdbserver


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]