diff options
Diffstat (limited to 'gdb/python/py-signalevent.c')
-rw-r--r-- | gdb/python/py-signalevent.c | 14 |
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, |