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] 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;
 }

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