* python/py-newobjfileevent.c (create_new_objfile_event_object):
authorTom Tromey <tromey@redhat.com>
Thu, 6 Sep 2012 20:14:13 +0000 (20:14 +0000)
committerTom Tromey <tromey@redhat.com>
Thu, 6 Sep 2012 20:14:13 +0000 (20:14 +0000)
Don't decref py_objfile.

gdb/ChangeLog
gdb/python/py-newobjfileevent.c

index 05b31423008e50fbd595eecd226790922e669f16..ffc5c9443178ab6bcbe35d67e68bfa22c86db507 100644 (file)
@@ -1,3 +1,8 @@
+2012-09-06  Tom Tromey  <tromey@redhat.com>
+
+       * python/py-newobjfileevent.c (create_new_objfile_event_object):
+       Don't decref py_objfile.
+
 2012-09-02  Khoo Yit Phang  <khooyp@cs.umd.edu>
 
        Do not enable -lmcheck by default when Python is enabled with
index 3059ae4b6a1d6c692567e9ac0d7fa26eb019ac08..46b26abff266a61ff7a074be36c6e2fd59f2424b 100644 (file)
@@ -25,23 +25,23 @@ 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)
     goto fail;
 
+  /* Note that objfile_to_objfile_object returns a borrowed reference,
+     so we don't need a decref here.  */
   py_objfile = objfile_to_objfile_object (objfile);
   if (!py_objfile || evpy_add_attribute (objfile_event,
                                          "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;
 }