SF bug #808756: refleaks in _hotshot.c.
diff --git a/Modules/_hotshot.c b/Modules/_hotshot.c
index 0683be6..b75b1a3 100644
--- a/Modules/_hotshot.c
+++ b/Modules/_hotshot.c
@@ -347,9 +347,11 @@
goto finally;
}
if (PyDict_SetItem(self->info, key, list)) {
+ Py_DECREF(list);
err = ERR_EXCEPTION;
goto finally;
}
+ Py_DECREF(list);
}
if (PyList_Append(list, value))
err = ERR_EXCEPTION;
@@ -519,6 +521,7 @@
fclose(self->logfp);
self->logfp = NULL;
}
+ Py_XDECREF(self->info);
PyObject_Del(self);
}
@@ -795,11 +798,16 @@
PyObject *name = PyDict_GetItem(dict, obj);
if (name == NULL) {
if (pack_define_func(self, fileno, fcode->co_firstlineno,
- PyString_AS_STRING(fcode->co_name)) < 0)
+ PyString_AS_STRING(fcode->co_name)) < 0) {
+ Py_DECREF(obj);
return -1;
- if (PyDict_SetItem(dict, obj, fcode->co_name))
+ }
+ if (PyDict_SetItem(dict, obj, fcode->co_name)) {
+ Py_DECREF(obj);
return -1;
+ }
}
+ Py_DECREF(obj);
}
return fileno;
}