Thiago Jung Bauermann | 2 Mar 2009 14:27
Picon

[python] Verify if given var name exists, and plug memory leak.

Hi,

frapy_read_var_frame was leaking the var_name buffer. Also, it didn't
check the return value of lookup_symbol.

Also, update testcase to test functions and methods which weren't being
tested.

Committed.

gdb/
	* python/python-frame.c (frapy_read_var_value): Don't leak variable
	name, and verify if variable with given name exists.

gdb/testsuite/
	* gdb.python/python-frame.exp: Add tests for Frame.read_var_value,
	gdb.newest_frame, gdb.selected_frame and
	gdb.frame_unwind_stop_reason_string.

diff --git a/gdb/python/python-frame.c b/gdb/python/python-frame.c
index 1f152b8..131aad1 100644
--- a/gdb/python/python-frame.c
+++ b/gdb/python/python-frame.c
 <at>  <at>  -413,20 +413,32  <at>  <at>  frapy_read_var_value (PyObject *self, PyObject *args)
   else if (gdbpy_is_string (sym_obj))
     {
       char *var_name;
-      struct block *block;
+      struct block *block = NULL;
+      struct cleanup *cleanup;
(Continue reading)


Gmane