gh-140939: Fix memory leak in _PyBytes_FormatEx error path (#140957)

This commit is contained in:
Stan Ulbrych 2025-11-06 05:50:57 +00:00 committed by GitHub
parent 9037a386c6
commit d6c89a2df2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 0 deletions

View file

@ -985,6 +985,7 @@ _PyBytes_FormatEx(const char *format, Py_ssize_t format_len,
if (alloc > 2) {
res = PyBytesWriter_GrowAndUpdatePointer(writer, alloc - 2, res);
if (res == NULL) {
Py_XDECREF(temp);
goto error;
}
}