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]

[RFA] Fix memory leak in gdbserver/hostio.c


Found by coverity.

2011-02-26  Michael Snyder  <msnyder@vmware.com>

	* hostio.c (handle_pwrite): Free alloced buffer on early return.

Index: hostio.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/hostio.c,v
retrieving revision 1.11
diff -u -p -u -p -r1.11 hostio.c
--- hostio.c	1 Jan 2011 15:33:24 -0000	1.11
+++ hostio.c	27 Feb 2011 00:27:20 -0000
@@ -367,6 +367,7 @@ handle_pwrite (char *own_buf, int packet
       || require_data (p, packet_len - (p - own_buf), &data, &len))
     {
       hostio_packet_error (own_buf);
+      free (data);
       return;
     }
 

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