[PATCH 15/28] fix bug in gdbpy_initialize_event_generic

Tom Tromey
2013-04-19T14:36:35Z

The checker noticed that gdbpy_initialize_event_generic could do an
extra decref of 'type' if PyType_Ready failed. This fixes the bug.

* python/py-event.c (gdbpy_initialize_event_generic): Return
early if PyType_Ready fails.
---
gdb/python/py-event.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/python/py-event.c b/gdb/python/py-event.c
index afd07fe..72d57cb 100644
--- a/gdb/python/py-event.c
+++ b/gdb/python/py-event.c
@@ -76,7 +76,7 @@ gdbpy_initialize_event_generic (PyTypeObject *type,
char *name)
{
if (PyType_Ready (type) < 0)
- goto fail;
+ return -1;

Py_INCREF (type);
if (PyModule_AddObject (gdb_module, name, (PyObject *) type) < 0)
--
1.8.1.4

Tom