SIGN IN SIGN UP

gh-148688: Fix _BlocksOutputBuffer_Finish() double free (#148689)

If _BlocksOutputBuffer_Finish() fails (memory allocation failure),
PyBytesWriter_Discard() is called on the writer. Then if
_BlocksOutputBuffer_OnError() is called, it calls again
PyBytesWriter_Discard() causing a double free.

Fix _BlocksOutputBuffer_Finish() by setting buffer->writer to NULL,
so _BlocksOutputBuffer_OnError() does nothing instead of calling
PyBytesWriter_Discard() again.
V
Victor Stinner committed
d61fcf834d197f0113a6a507fdbecc1545d9d483
Parent: e9bbf86
Committed by GitHub <noreply@github.com> on 4/18/2026, 9:56:56 AM