diff options
author | Guido van Rossum <guido@python.org> | 1997-11-11 16:29:38 +0000 |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1997-11-11 16:29:38 +0000 |
commit | e799c53acabfa9226957ee830423f25cc50f1550 (patch) | |
tree | c000127d4ffe15d110235a46dc377bf161f3b02d /Python | |
parent | fd909ee931a59d75da83d222ba93593fda568167 (diff) | |
download | cpython-e799c53acabfa9226957ee830423f25cc50f1550.tar.gz |
Fix memory leak in exec statement with code object -- the None returned
by PyEval_EvalCode() on success was never DECREF'ed.
Fix by Bernhard Herzog.
Diffstat (limited to 'Python')
-rw-r--r-- | Python/ceval.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Python/ceval.c b/Python/ceval.c index dd7faf945c..fb179d1aa6 100644 --- a/Python/ceval.c +++ b/Python/ceval.c @@ -2773,9 +2773,11 @@ exec_statement(f, prog, globals, locals) if (PyDict_GetItemString(globals, "__builtins__") == NULL) PyDict_SetItemString(globals, "__builtins__", f->f_builtins); if (PyCode_Check(prog)) { - if (PyEval_EvalCode((PyCodeObject *) prog, - globals, locals) == NULL) + v = PyEval_EvalCode((PyCodeObject *) prog, + globals, locals); + if (v == NULL) return -1; + Py_DECREF(v); return 0; } if (PyFile_Check(prog)) { |