aboutsummaryrefslogtreecommitdiff
path: root/gdb/python/py-newobjfileevent.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/python/py-newobjfileevent.c')
-rw-r--r--gdb/python/py-newobjfileevent.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/gdb/python/py-newobjfileevent.c b/gdb/python/py-newobjfileevent.c
index aa31fb4..55e884d 100644
--- a/gdb/python/py-newobjfileevent.c
+++ b/gdb/python/py-newobjfileevent.c
@@ -28,12 +28,10 @@ create_new_objfile_event_object (struct objfile *objfile)
if (objfile_event == NULL)
return NULL;
- /* Note that objfile_to_objfile_object returns a borrowed reference,
- so we don't need a decref here. */
- PyObject *py_objfile = objfile_to_objfile_object (objfile);
- if (!py_objfile || evpy_add_attribute (objfile_event.get (),
- "new_objfile",
- py_objfile) < 0)
+ gdbpy_ref<> py_objfile = objfile_to_objfile_object (objfile);
+ if (py_objfile == NULL || evpy_add_attribute (objfile_event.get (),
+ "new_objfile",
+ py_objfile.get ()) < 0)
return NULL;
return objfile_event;