]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Fix memory leak with from import ...
authorMoshe Zadka <moshez@math.huji.ac.il>
Fri, 30 Mar 2001 18:50:23 +0000 (18:50 +0000)
committerMoshe Zadka <moshez@math.huji.ac.il>
Fri, 30 Mar 2001 18:50:23 +0000 (18:50 +0000)
Python/compile.c

index 77ae001c111452065f70c635c0794acb8c5cf8dd..aca1705b211a853e6afd63a7a6a54fc446be46a1 100644 (file)
@@ -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)