Commit 74b3bc4
committed
Fix for bug 133489: compiler leaks memory
Two different but related problems:
1. PySymtable_Free() must explicitly DECREF(st->st_cur), which should
always point to the global symtable entry. This entry is setup by the
first enter_scope() call, but there is never a corresponding
exit_scope() call.
Since each entry has a reference to scopes defined within it, the
missing DECREF caused all symtable entries to be leaked.
2. The leak here masked a separate problem with
PySymtableEntry_New(). When the requested entry was found in
st->st_symbols, the entry was returned without doing an INCREF.
And problem c) The ste_children slot was getting two copies of each
child entry, because it was populating the slot on the first and
second passes. Now only populate on the first pass.1 parent 3e13b1e commit 74b3bc4
2 files changed
Lines changed: 11 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3912 | 3912 | | |
3913 | 3913 | | |
3914 | 3914 | | |
3915 | | - | |
| 3915 | + | |
3916 | 3916 | | |
| 3917 | + | |
| 3918 | + | |
3917 | 3919 | | |
3918 | 3920 | | |
3919 | 3921 | | |
| |||
4193 | 4195 | | |
4194 | 4196 | | |
4195 | 4197 | | |
| 4198 | + | |
4196 | 4199 | | |
4197 | 4200 | | |
4198 | 4201 | | |
| |||
4359 | 4362 | | |
4360 | 4363 | | |
4361 | 4364 | | |
4362 | | - | |
| 4365 | + | |
4363 | 4366 | | |
4364 | 4367 | | |
4365 | 4368 | | |
| 4369 | + | |
4366 | 4370 | | |
4367 | 4371 | | |
4368 | 4372 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
16 | | - | |
17 | | - | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
69 | 71 | | |
70 | 72 | | |
71 | 73 | | |
72 | | - | |
| 74 | + | |
73 | 75 | | |
74 | 76 | | |
75 | 77 | | |
| |||
0 commit comments