2011-03-05 Michael Snyder <msnyder@vmware.com>
authorMichael Snyder <msnyder@vmware.com>
Mon, 7 Mar 2011 19:53:34 +0000 (19:53 +0000)
committerMichael Snyder <msnyder@vmware.com>
Mon, 7 Mar 2011 19:53:34 +0000 (19:53 +0000)
* ser-unix.c (hardwire_get_tty_state): Stop memory leak.

gdb/ChangeLog
gdb/ser-unix.c

index 8f7a58fb6ddb9ee3b94805cd07a9350572772e7d..6cb27eed81c020792848d0310e2d3764e54c28d9 100644 (file)
@@ -1,5 +1,7 @@
 2011-03-06  Michael Snyder  <msnyder@vmware.com>
 
+       * ser-unix.c (hardwire_get_tty_state): Stop memory leak.
+
        * mi/mi-cmd-env.c (_initialize_mi_cmd_env): Free environment.
 
        * elfread.c (elf_symtab_read): Stop memory leak.
index da3a4c30b61484d3d08fe509b1c17d7b8ec5d16d..c541452a8ccbde330cb1e6010ded857591e09821 100644 (file)
@@ -183,7 +183,10 @@ hardwire_get_tty_state (struct serial *scb)
   state = (struct hardwire_ttystate *) xmalloc (sizeof *state);
 
   if (get_tty_state (scb, state))
-    return NULL;
+    {
+      xfree (state);
+      return NULL;
+    }
 
   return (serial_ttystate) state;
 }