This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] ser-unix.c (hardwire_get_tty_state): Stop memory leak.
- From: Michael Snyder <msnyder at vmware dot com>
- To: "gdb-patches at sourceware dot org" <gdb-patches at sourceware dot org>
- Date: Sat, 05 Mar 2011 13:12:49 -0800
- Subject: [RFA] ser-unix.c (hardwire_get_tty_state): Stop memory leak.
OK?
2011-03-05 Michael Snyder <msnyder@vmware.com>
* ser-unix.c (hardwire_get_tty_state): Stop memory leak.
Index: ser-unix.c
===================================================================
RCS file: /cvs/src/src/gdb/ser-unix.c,v
retrieving revision 1.39
diff -u -p -r1.39 ser-unix.c
--- ser-unix.c 4 Mar 2011 19:23:42 -0000 1.39
+++ ser-unix.c 5 Mar 2011 21:09:16 -0000
@@ -183,7 +183,10 @@ hardwire_get_tty_state (struct serial *s
state = (struct hardwire_ttystate *) xmalloc (sizeof *state);
if (get_tty_state (scb, state))
- return NULL;
+ {
+ xfree (state);
+ return NULL;
+ }
return (serial_ttystate) state;
}