diff options
author | Tom Tromey <tromey@redhat.com> | 2013-05-20 20:34:48 +0000 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2013-05-20 20:34:48 +0000 |
commit | a1dc2890b9843e7bbadb81cf7d733d2954dbb097 (patch) | |
tree | 3064bc1c3ca2b7dd6cbfc970e4e578b9edb51463 /gdb/python/python.c | |
parent | c84620664b6cd95ef9d2609c73c6832dba830cdf (diff) | |
download | gdb-a1dc2890b9843e7bbadb81cf7d733d2954dbb097.tar.gz |
* python/py-cmd.c (cmdpy_completer): Use explicit decref.
* python/py-param.c (get_set_value, get_show_value): Use
explicit decrefs.
* python/python.c (start_type_printers, apply_type_printers):
Use explicit decrefs.
Diffstat (limited to 'gdb/python/python.c')
-rw-r--r-- | gdb/python/python.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/gdb/python/python.c b/gdb/python/python.c index 605efc04ae9..d8b0de639a0 100644 --- a/gdb/python/python.c +++ b/gdb/python/python.c @@ -1232,7 +1232,7 @@ void * start_type_printers (void) { struct cleanup *cleanups; - PyObject *type_module, *func, *result_obj = NULL; + PyObject *type_module, *func = NULL, *result_obj = NULL; if (!gdb_python_initialized) return NULL; @@ -1245,7 +1245,6 @@ start_type_printers (void) gdbpy_print_stack (); goto done; } - make_cleanup_py_decref (type_module); func = PyObject_GetAttrString (type_module, "get_type_recognizers"); if (func == NULL) @@ -1253,13 +1252,14 @@ start_type_printers (void) gdbpy_print_stack (); goto done; } - make_cleanup_py_decref (func); result_obj = PyObject_CallFunctionObjArgs (func, (char *) NULL); if (result_obj == NULL) gdbpy_print_stack (); done: + Py_XDECREF (type_module); + Py_XDECREF (func); do_cleanups (cleanups); return result_obj; } @@ -1276,7 +1276,8 @@ char * apply_type_printers (void *printers, struct type *type) { struct cleanup *cleanups; - PyObject *type_obj, *type_module, *func, *result_obj; + PyObject *type_obj, *type_module = NULL, *func = NULL; + PyObject *result_obj = NULL; PyObject *printers_obj = printers; char *result = NULL; @@ -1294,7 +1295,6 @@ apply_type_printers (void *printers, struct type *type) gdbpy_print_stack (); goto done; } - make_cleanup_py_decref (type_obj); type_module = PyImport_ImportModule ("gdb.types"); if (type_module == NULL) @@ -1302,7 +1302,6 @@ apply_type_printers (void *printers, struct type *type) gdbpy_print_stack (); goto done; } - make_cleanup_py_decref (type_module); func = PyObject_GetAttrString (type_module, "apply_type_recognizers"); if (func == NULL) @@ -1310,7 +1309,6 @@ apply_type_printers (void *printers, struct type *type) gdbpy_print_stack (); goto done; } - make_cleanup_py_decref (func); result_obj = PyObject_CallFunctionObjArgs (func, printers_obj, type_obj, (char *) NULL); @@ -1319,7 +1317,6 @@ apply_type_printers (void *printers, struct type *type) gdbpy_print_stack (); goto done; } - make_cleanup_py_decref (result_obj); if (result_obj != Py_None) { @@ -1329,6 +1326,10 @@ apply_type_printers (void *printers, struct type *type) } done: + Py_XDECREF (type_obj); + Py_XDECREF (type_module); + Py_XDECREF (func); + Py_XDECREF (result_obj); do_cleanups (cleanups); return result; } |