* py-evtregistry.c (create_event_object): Decref
authorTom Tromey <tromey@redhat.com>
Mon, 20 May 2013 20:16:24 +0000 (20:16 +0000)
committerTom Tromey <tromey@redhat.com>
Mon, 20 May 2013 20:16:24 +0000 (20:16 +0000)
eventregistry_object if PyList_New fails.

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

index a9f4354e03306a217d09b7df0baf4fca23ff75f5..8b417da7032cb8556939934614eca5e6b00b6aff 100644 (file)
@@ -1,3 +1,8 @@
+2013-05-20  Tom Tromey  <tromey@redhat.com>
+
+       * py-evtregistry.c (create_event_object): Decref
+       eventregistry_object if PyList_New fails.
+
 2013-05-20  Tom Tromey  <tromey@redhat.com>
 
        * py-cmd.c (gdbpy_string_to_argv): Check result of
index c8003af9af7d28d785a7105d81f6469e18b3bdf3..05c85864e7157128c0e8b9faeb88c7ed40a4b000 100644 (file)
@@ -89,7 +89,10 @@ create_eventregistry_object (void)
 
   eventregistry_obj->callbacks = PyList_New (0);
   if (!eventregistry_obj->callbacks)
-    return NULL;
+    {
+      Py_DECREF (eventregistry_obj);
+      return NULL;
+    }
 
   return eventregistry_obj;
 }