Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 986e224

Browse files
committed
Issue #18408: Fix error handling in PyBytes_FromObject()
_PyBytes_Resize(&new) sets new to NULL on error, don't call Py_DECREF() with NULL.
1 parent cc024d1 commit 986e224

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

Objects/bytesobject.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2660,9 +2660,8 @@ PyBytes_FromObject(PyObject *x)
26602660
return new;
26612661

26622662
error:
2663-
/* Error handling when new != NULL */
26642663
Py_XDECREF(it);
2665-
Py_DECREF(new);
2664+
Py_XDECREF(new);
26662665
return NULL;
26672666
}
26682667

0 commit comments

Comments
 (0)