Skip to content

Commit d572dad

Browse files
committed
Fix memory leak
1 parent b9da2ce commit d572dad

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Objects/bytesobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3756,12 +3756,12 @@ PyBytesWriter_FinishWithSize(PyBytesWriter *writer, Py_ssize_t size)
37563756
// example, _PyBytes_Resize() raises SystemError on negative size.
37573757
if (size < 0) {
37583758
PyErr_Format(PyExc_ValueError, "size must be positive");
3759-
return NULL;
3759+
goto error;
37603760
}
37613761

37623762
if (size > writer->size) {
37633763
PyErr_SetString(PyExc_ValueError, "size larger than allocated size");
3764-
return NULL;
3764+
goto error;
37653765
}
37663766

37673767
PyObject *result;

0 commit comments

Comments
 (0)