aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2013-05-20 20:12:04 +0000
committerTom Tromey <tromey@redhat.com>2013-05-20 20:12:04 +0000
commit764123e402e5f69fff1519b16150bc0e710f470c (patch)
tree380cf78de94b0417bf53e74352d7c45ddcef3ffd
parent634c58be55bc36d8b568057263352a64cc7478a5 (diff)
downloadbinutils-764123e402e5f69fff1519b16150bc0e710f470c.zip
binutils-764123e402e5f69fff1519b16150bc0e710f470c.tar.gz
binutils-764123e402e5f69fff1519b16150bc0e710f470c.tar.bz2
* python/py-function.c (fnpy_init): Decref result of
PyObject_GetAttrString.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/python/py-function.c16
2 files changed, 16 insertions, 5 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b4fb20c..443adaf 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,10 @@
2013-05-20 Tom Tromey <tromey@redhat.com>
+ * python/py-function.c (fnpy_init): Decref result of
+ PyObject_GetAttrString.
+
+2013-05-20 Tom Tromey <tromey@redhat.com>
+
* python/py-threadevent.c (get_event_thread): Use
CPYCHECKER_RETURNS_BORROWED_REF.
* python/python-internal.h (CPYCHECKER_RETURNS_BORROWED_REF):
diff --git a/gdb/python/py-function.c b/gdb/python/py-function.c
index e2ba19f..395eeda 100644
--- a/gdb/python/py-function.c
+++ b/gdb/python/py-function.c
@@ -175,14 +175,20 @@ fnpy_init (PyObject *self, PyObject *args, PyObject *kwds)
if (PyObject_HasAttrString (self, "__doc__"))
{
PyObject *ds_obj = PyObject_GetAttrString (self, "__doc__");
- if (ds_obj && gdbpy_is_string (ds_obj))
+ if (ds_obj != NULL)
{
- docstring = python_string_to_host_string (ds_obj);
- if (docstring == NULL)
+ if (gdbpy_is_string (ds_obj))
{
- Py_DECREF (self);
- return -1;
+ docstring = python_string_to_host_string (ds_obj);
+ if (docstring == NULL)
+ {
+ Py_DECREF (self);
+ Py_DECREF (ds_obj);
+ return -1;
+ }
}
+
+ Py_DECREF (ds_obj);
}
}
if (! docstring)