From 0b2381f5e125bdeb7e7aec65ac6b9647cf04771e Mon Sep 17 00:00:00 2001 From: Michael Snyder Date: Mon, 7 Mar 2011 19:53:34 +0000 Subject: [PATCH] 2011-03-05 Michael Snyder * ser-unix.c (hardwire_get_tty_state): Stop memory leak. --- gdb/ChangeLog | 2 ++ gdb/ser-unix.c | 5 ++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8f7a58fb6dd..6cb27eed81c 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,7 @@ 2011-03-06 Michael Snyder + * 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. diff --git a/gdb/ser-unix.c b/gdb/ser-unix.c index da3a4c30b61..c541452a8cc 100644 --- a/gdb/ser-unix.c +++ b/gdb/ser-unix.c @@ -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; } -- 2.30.2