Commit c426636
committed
Issue #18408: Fix _PyMem_DebugRealloc()
Don't mark old extra memory dead before calling realloc(). realloc() can fail
and realloc() must not touch the original buffer on failure.
So mark old extra memory dead only on success if the new buffer did not move
(has the same address).1 parent 9e6b4d7 commit c426636
1 file changed
Lines changed: 8 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1780 | 1780 | | |
1781 | 1781 | | |
1782 | 1782 | | |
1783 | | - | |
| 1783 | + | |
1784 | 1784 | | |
1785 | 1785 | | |
1786 | 1786 | | |
| |||
1797 | 1797 | | |
1798 | 1798 | | |
1799 | 1799 | | |
1800 | | - | |
1801 | | - | |
1802 | | - | |
1803 | | - | |
1804 | | - | |
1805 | 1800 | | |
1806 | 1801 | | |
1807 | 1802 | | |
1808 | 1803 | | |
| 1804 | + | |
1809 | 1805 | | |
1810 | 1806 | | |
1811 | 1807 | | |
1812 | 1808 | | |
| 1809 | + | |
| 1810 | + | |
| 1811 | + | |
| 1812 | + | |
| 1813 | + | |
1813 | 1814 | | |
1814 | 1815 | | |
1815 | 1816 | | |
1816 | 1817 | | |
1817 | 1818 | | |
| 1819 | + | |
1818 | 1820 | | |
1819 | 1821 | | |
1820 | 1822 | | |
| |||
0 commit comments