GDB crashing because of Python
Tom Tromey
tromey@redhat.com
Mon Aug 27 16:36:00 GMT 2012
>>>>> "Kevin" == Kevin Pouget <kevin.pouget@gmail.com> writes:
Kevin> so based on `git bisect`, it looks like the errors were introduced by
Kevin> this commit:
Can you please try the appended patch?
I think the bug here is that this code assumes that
objfile_to_objfile_object returns a new reference, but in fact it does
not.
While looking at this I think I found even more reference counting bugs.
Despair.
Tom
diff --git a/gdb/python/py-newobjfileevent.c b/gdb/python/py-newobjfileevent.c
index 3059ae4..d014be6 100644
--- a/gdb/python/py-newobjfileevent.c
+++ b/gdb/python/py-newobjfileevent.c
@@ -25,7 +25,7 @@ static PyObject *
create_new_objfile_event_object (struct objfile *objfile)
{
PyObject *objfile_event;
- PyObject *py_objfile = NULL;
+ PyObject *py_objfile;
objfile_event = create_event_object (&new_objfile_event_object_type);
if (!objfile_event)
@@ -36,12 +36,10 @@ create_new_objfile_event_object (struct objfile *objfile)
"new_objfile",
py_objfile) < 0)
goto fail;
- Py_DECREF (py_objfile);
return objfile_event;
fail:
- Py_XDECREF (py_objfile);
Py_XDECREF (objfile_event);
return NULL;
}
More information about the Gdb
mailing list