summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-03-21 21:26:58 (GMT)
committerGuido van Rossum <guido@python.org>2007-03-21 21:26:58 (GMT)
commit3a38362592ee423852d1b32a32d65520bc003ffc (patch)
treef5352df0d23241f16ed8f099080563a9566c09e6 /Python
parent390d29ca743d262cf667a794af71f141a7a161f6 (diff)
downloadcpython-3a38362592ee423852d1b32a32d65520bc003ffc.zip
cpython-3a38362592ee423852d1b32a32d65520bc003ffc.tar.gz
cpython-3a38362592ee423852d1b32a32d65520bc003ffc.tar.bz2
Fix refleak in compiler.
(A symbol table entry was leaked every time a class was compiled.)
Diffstat (limited to 'Python')
-rw-r--r--Python/compile.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 4c22441..a47c8e6 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -1519,6 +1519,7 @@ compiler_class(struct compiler *c, stmt_ty s)
PyCodeObject *co;
PyObject *str;
PySTEntryObject *ste;
+ int err;
/* initialize statics */
if (build_class == NULL) {
@@ -1547,7 +1548,9 @@ compiler_class(struct compiler *c, stmt_ty s)
if (ste == NULL)
return 0;
assert(PyList_Check(ste->ste_varnames));
- if (PyList_Append(ste->ste_varnames, locals) < 0)
+ err = PyList_Append(ste->ste_varnames, locals);
+ Py_DECREF(ste);
+ if (err < 0)
return 0;
/* 1. compile the class body into a code object */