]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
fix possibily uninitialized memory usage (closes #12474)
authorBenjamin Peterson <benjamin@python.org>
Sat, 2 Jul 2011 14:22:13 +0000 (09:22 -0500)
committerBenjamin Peterson <benjamin@python.org>
Sat, 2 Jul 2011 14:22:13 +0000 (09:22 -0500)
Python/symtable.c

index 82b1ebb7fa868f21438f82af34227178f2ee03b0..a0bedfc767e331bcca8756636f2496c6cf4cb92b 100644 (file)
@@ -904,10 +904,10 @@ symtable_exit_block(struct symtable *st, void *ast)
     st->st_cur = NULL;
     size = PyList_GET_SIZE(st->st_stack);
     if (size) {
-        st->st_cur = (PySTEntryObject *)PyList_GET_ITEM(st->st_stack,
-                                                        size - 2);
         if (PyList_SetSlice(st->st_stack, size - 1, size, NULL) < 0)
             return 0;
+        if (--size)
+            st->st_cur = (PySTEntryObject *)PyList_GET_ITEM(st->st_stack, size - 1);
     }
     return 1;
 }