aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-signalevent.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-08-15 14:22:02 +0000
committerTom Tromey <tromey@redhat.com>2012-08-15 14:22:02 +0000
commitdb6573d6646f950b5a758fd68d180de8ae1e8981 (patch)
tree5c1765409a97237e924cd9f3a0dbaff697f631de /gdb/python/py-signalevent.c
parenta036ba48efc7145d0cd2de136be0443b65f672d2 (diff)
downloadbinutils-db6573d6646f950b5a758fd68d180de8ae1e8981.zip
binutils-db6573d6646f950b5a758fd68d180de8ae1e8981.tar.gz
binutils-db6573d6646f950b5a758fd68d180de8ae1e8981.tar.bz2
PR python/14387:
* python/py-bpevent.c (create_breakpoint_event_object): Update comment. * python/py-event.c (evpy_add_attribute): Update comment. * python/py-exitedevent.c (create_exited_event_object): Fix reference counting and error handling. * python/py-newobjfileevent.c (create_new_objfile_event_object): Fix reference counting. * python/py-signalevent.c (create_signal_event_object): Fix reference counting and error handling. * python/py-stopevent.c (emit_stop_event): Fix reference counting. * python/py-threadevent.c (get_event_thread): Return a borrowed reference. * python/py-type.c (convert_field): Fix reference counting.
Diffstat (limited to 'gdb/python/py-signalevent.c')
-rw-r--r--gdb/python/py-signalevent.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/gdb/python/py-signalevent.c b/gdb/python/py-signalevent.c
index 304b847..40da31a 100644
--- a/gdb/python/py-signalevent.c
+++ b/gdb/python/py-signalevent.c
@@ -25,6 +25,7 @@ PyObject *
create_signal_event_object (enum gdb_signal stop_signal)
{
const char *signal_name;
+ PyObject *signal_name_obj = NULL;
PyObject *signal_event_obj =
create_stop_event_object (&signal_event_object_type);
@@ -33,16 +34,21 @@ create_signal_event_object (enum gdb_signal stop_signal)
signal_name = gdb_signal_to_name (stop_signal);
+ signal_name_obj = PyString_FromString (signal_name);
+ if (signal_name_obj == NULL)
+ goto fail;
if (evpy_add_attribute (signal_event_obj,
"stop_signal",
- PyString_FromString (signal_name)) < 0)
+ signal_name_obj) < 0)
goto fail;
+ Py_DECREF (signal_name_obj);
return signal_event_obj;
- fail:
- Py_XDECREF (signal_event_obj);
- return NULL;
+ fail:
+ Py_XDECREF (signal_name_obj);
+ Py_XDECREF (signal_event_obj);
+ return NULL;
}
GDBPY_NEW_EVENT_TYPE (signal,