summaryrefslogtreecommitdiffstats
path: root/Python/bltinmodule.c
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2000-06-20 04:54:19 (GMT)
committerFred Drake <fdrake@acm.org>2000-06-20 04:54:19 (GMT)
commit5550de3084d6686032479b3cb9e34337eea24f7b (patch)
tree662c2e62162c0a800c78380950aa9bdc75e44d40 /Python/bltinmodule.c
parent91c4e2bf127bb06204dc0a9a4583be7dccc27098 (diff)
downloadcpython-5550de3084d6686032479b3cb9e34337eea24f7b.zip
cpython-5550de3084d6686032479b3cb9e34337eea24f7b.tar.gz
cpython-5550de3084d6686032479b3cb9e34337eea24f7b.tar.bz2
Christopher Fandrich <cfandrich@8cs.com>:
Fix memory leak in initializing __debug__.
Diffstat (limited to 'Python/bltinmodule.c')
-rw-r--r--Python/bltinmodule.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index f4a7802..6d2a0fc 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -2364,7 +2364,7 @@ Noteworthy: None is the `nil' object; Ellipsis represents `...' in slices.";
PyObject *
_PyBuiltin_Init()
{
- PyObject *mod, *dict;
+ PyObject *mod, *dict, *debug;
mod = Py_InitModule4("__builtin__", builtin_methods,
builtin_doc, (PyObject *)NULL,
PYTHON_API_VERSION);
@@ -2375,9 +2375,12 @@ _PyBuiltin_Init()
return NULL;
if (PyDict_SetItemString(dict, "Ellipsis", Py_Ellipsis) < 0)
return NULL;
- if (PyDict_SetItemString(dict, "__debug__",
- PyInt_FromLong(Py_OptimizeFlag == 0)) < 0)
+ debug = PyInt_FromLong(Py_OptimizeFlag == 0);
+ if (PyDict_SetItemString(dict, "__debug__", debug) < 0) {
+ Py_XDECREF(debug);
return NULL;
+ }
+ Py_XDECREF(debug);
return mod;
}