]> granicus.if.org Git - python/commitdiff
Issue #18408: Fix error handling in PyBytes_FromObject()
authorVictor Stinner <victor.stinner@gmail.com>
Tue, 29 Oct 2013 02:14:22 +0000 (03:14 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Tue, 29 Oct 2013 02:14:22 +0000 (03:14 +0100)
_PyBytes_Resize(&new) sets new to NULL on error, don't call Py_DECREF() with NULL.

Objects/bytesobject.c

index 613269045bb9525af16fe8ba68bfc1505032bac1..529c634708c506f1ca86f72d009e17299e05068b 100644 (file)
@@ -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;
 }