summaryrefslogtreecommitdiff
path: root/Python/symtable.c
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2011-07-02 09:22:13 -0500
committerBenjamin Peterson <benjamin@python.org>2011-07-02 09:22:13 -0500
commit0c131a7b4cff5aa25bb4fd1757e4874efb4523f6 (patch)
tree7344187733c45ef7ad9a41f842e2d8851a19606f /Python/symtable.c
parentbb602cfe63312763aab608835e6e7be36d5b7cc3 (diff)
downloadcpython-0c131a7b4cff5aa25bb4fd1757e4874efb4523f6.tar.gz
fix possibily uninitialized memory usage (closes #12474)
Diffstat (limited to 'Python/symtable.c')
-rw-r--r--Python/symtable.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/Python/symtable.c b/Python/symtable.c
index 82b1ebb7fa..a0bedfc767 100644
--- a/Python/symtable.c
+++ b/Python/symtable.c
@@ -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;
}