summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2000-11-27 22:22:36 (GMT)
committerGuido van Rossum <guido@python.org>2000-11-27 22:22:36 (GMT)
commit83fb073a0307e5585cc99fce52c169c0fa8562f4 (patch)
treef4a81234170814563234d1d9adb2137fff4fb8cc /Python
parentf8baad0f1759a5b26b050636fd327e874e17c5a0 (diff)
downloadcpython-83fb073a0307e5585cc99fce52c169c0fa8562f4.zip
cpython-83fb073a0307e5585cc99fce52c169c0fa8562f4.tar.gz
cpython-83fb073a0307e5585cc99fce52c169c0fa8562f4.tar.bz2
Plug a memory leak in com_import_stmt(): the tuple created to hold the
"..." in "from M import ..." was never DECREFed. Leak reported by James Slaughter and nailed by Barry, who also provided an earlier version of this patch.
Diffstat (limited to 'Python')
-rw-r--r--Python/compile.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Python/compile.c b/Python/compile.c
index 77ae001..aca1705 100644
--- a/Python/compile.c
+++ b/Python/compile.c
@@ -2325,11 +2325,11 @@ static void
com_import_stmt(struct compiling *c, node *n)
{
int i;
- PyObject *tup;
REQ(n, import_stmt);
/* 'import' dotted_name (',' dotted_name)* |
'from' dotted_name 'import' ('*' | NAME (',' NAME)*) */
if (STR(CHILD(n, 0))[0] == 'f') {
+ PyObject *tup;
/* 'from' dotted_name 'import' ... */
REQ(CHILD(n, 1), dotted_name);
@@ -2344,6 +2344,7 @@ com_import_stmt(struct compiling *c, node *n)
}
}
com_addoparg(c, LOAD_CONST, com_addconst(c, tup));
+ Py_DECREF(tup);
com_push(c, 1);
com_addopname(c, IMPORT_NAME, CHILD(n, 1));
if (TYPE(CHILD(n, 3)) == STAR)