summaryrefslogtreecommitdiffstats
path: root/Modules/gdbmmodule.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2001-11-11 14:24:05 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2001-11-11 14:24:05 (GMT)
commit00ff10cae426a529ea9aa473e0ba9ab905cf7c81 (patch)
treef0f623e4347d8e821c86bd5e57dd275240aa4954 /Modules/gdbmmodule.c
parent20efa68be43b18413cc08089211b1351687084af (diff)
downloadcpython-00ff10cae426a529ea9aa473e0ba9ab905cf7c81.zip
cpython-00ff10cae426a529ea9aa473e0ba9ab905cf7c81.tar.gz
cpython-00ff10cae426a529ea9aa473e0ba9ab905cf7c81.tar.bz2
Patch in bug report #477700: Fix memory leaks in gdbm & curses.
Diffstat (limited to 'Modules/gdbmmodule.c')
-rw-r--r--Modules/gdbmmodule.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/Modules/gdbmmodule.c b/Modules/gdbmmodule.c
index 5f83a28..0190a9b 100644
--- a/Modules/gdbmmodule.c
+++ b/Modules/gdbmmodule.c
@@ -505,7 +505,7 @@ static PyMethodDef dbmmodule_methods[] = {
DL_EXPORT(void)
initgdbm(void) {
- PyObject *m, *d;
+ PyObject *m, *d, *s;
Dbmtype.ob_type = &PyType_Type;
m = Py_InitModule4("gdbm", dbmmodule_methods,
@@ -515,7 +515,8 @@ initgdbm(void) {
DbmError = PyErr_NewException("gdbm.error", NULL, NULL);
if (DbmError != NULL) {
PyDict_SetItemString(d, "error", DbmError);
- PyDict_SetItemString(d, "open_flags",
- PyString_FromString(dbmmodule_open_flags));
+ s = PyString_FromString(dbmmodule_open_flags);
+ PyDict_SetItemString(d, "open_flags", s);
+ Py_DECREF(s);
}
}