From: Victor Stinner Date: Tue, 29 Oct 2013 02:14:22 +0000 (+0100) Subject: Issue #18408: Fix error handling in PyBytes_FromObject() X-Git-Tag: v3.4.0b1~489 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=986e224d5a71342b683975ea0240315a8264616b;p=python Issue #18408: Fix error handling in PyBytes_FromObject() _PyBytes_Resize(&new) sets new to NULL on error, don't call Py_DECREF() with NULL. --- diff --git a/Objects/bytesobject.c b/Objects/bytesobject.c index 613269045b..529c634708 100644 --- a/Objects/bytesobject.c +++ b/Objects/bytesobject.c @@ -2660,9 +2660,8 @@ PyBytes_FromObject(PyObject *x) return new; error: - /* Error handling when new != NULL */ Py_XDECREF(it); - Py_DECREF(new); + Py_XDECREF(new); return NULL; }