diff Python/symtable.c @ 71129:6b3872a11299

fix possibily uninitialized memory usage (closes #12474)
author Benjamin Peterson <benjamin@python.org>
date Sat, 02 Jul 2011 09:22:13 -0500
parents 151142c0c5b1
children 8beaa9a37387
line wrap: on
line diff
--- a/Python/symtable.c	Sat Jul 02 14:43:11 2011 +0200
+++ b/Python/symtable.c	Sat Jul 02 09:22:13 2011 -0500
@@ -904,10 +904,10 @@
     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;
 }