From: Tom Tromey Date: Sun, 20 Nov 2016 17:48:51 +0000 (-0700) Subject: Use gdbpy_ref in pyuw_object_attribute_to_pointer X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=4586d54305ed275bb909f3373a7372c02d7e579e;p=binutils-gdb.git Use gdbpy_ref in pyuw_object_attribute_to_pointer This changes pyuw_object_attribute_to_pointer to use gdbpy_ref. 2017-01-10 Tom Tromey * python/py-unwind.c (pyuw_object_attribute_to_pointer): Use gdbpy_ref. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index f4f5e0b3678..68eaf566d5a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2017-01-10 Tom Tromey + + * python/py-unwind.c (pyuw_object_attribute_to_pointer): Use + gdbpy_ref. + 2017-01-10 Tom Tromey * python/python.c (eval_python_command, gdbpy_decode_line) diff --git a/gdb/python/py-unwind.c b/gdb/python/py-unwind.c index c0bc0c214ba..690412a0ecb 100644 --- a/gdb/python/py-unwind.c +++ b/gdb/python/py-unwind.c @@ -177,18 +177,17 @@ pyuw_object_attribute_to_pointer (PyObject *pyo, const char *attr_name, if (PyObject_HasAttrString (pyo, attr_name)) { - PyObject *pyo_value = PyObject_GetAttrString (pyo, attr_name); + gdbpy_ref pyo_value (PyObject_GetAttrString (pyo, attr_name)); if (pyo_value != NULL && pyo_value != Py_None) { - rc = pyuw_value_obj_to_pointer (pyo_value, addr); + rc = pyuw_value_obj_to_pointer (pyo_value.get (), addr); if (!rc) PyErr_Format ( PyExc_ValueError, _("The value of the '%s' attribute is not a pointer."), attr_name); } - Py_XDECREF (pyo_value); } return rc; }