From 4c2d572468f9adde02d19abeda30ce76390cbaad Mon Sep 17 00:00:00 2001 From: Michael Snyder Date: Fri, 11 Mar 2011 21:34:34 +0000 Subject: [PATCH] 2011-02-27 Michael Snyder * python/py-breakpoint.c (bppy_get_commands): Fix memory leak. --- gdb/ChangeLog | 2 ++ gdb/python/py-breakpoint.c | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2181f35c80a..13f9b162c1d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,7 @@ 2011-03-11 Michael Snyder + * python/py-breakpoint.c (bppy_get_commands): Fix memory leak. + * top.c (set_verbose): Assert showcmd was found. 2011-03-11 Maxim Grigoriev diff --git a/gdb/python/py-breakpoint.c b/gdb/python/py-breakpoint.c index bfad002d1ae..c8308b99a9d 100644 --- a/gdb/python/py-breakpoint.c +++ b/gdb/python/py-breakpoint.c @@ -489,12 +489,12 @@ bppy_get_commands (PyObject *self, void *closure) print_command_lines (uiout, breakpoint_commands (bp), 0); } ui_out_redirect (uiout, NULL); - cmdstr = ui_file_xstrdup (string_file, &length); GDB_PY_HANDLE_EXCEPTION (except); + cmdstr = ui_file_xstrdup (string_file, &length); + make_cleanup (xfree, cmdstr); result = PyString_Decode (cmdstr, strlen (cmdstr), host_charset (), NULL); do_cleanups (chain); - xfree (cmdstr); return result; } -- 2.30.2