This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GDB crashing because of Python

>>>>> "Kevin" == Kevin Pouget <> 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

While looking at this I think I found even more reference counting bugs.


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)
                                          py_objfile) < 0)
     goto fail;
-  Py_DECREF (py_objfile);
   return objfile_event;
-  Py_XDECREF (py_objfile);
   Py_XDECREF (objfile_event);
   return NULL;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]