]> granicus.if.org Git - python/commitdiff
Fix refleak: decref inputobj after extracting the relavant info (the object
authorWalter Dörwald <walter@livinglogic.de>
Fri, 10 Aug 2007 10:11:43 +0000 (10:11 +0000)
committerWalter Dörwald <walter@livinglogic.de>
Fri, 10 Aug 2007 10:11:43 +0000 (10:11 +0000)
won't go away, as the exception object holds another reference).

Objects/unicodeobject.c

index 98147e8f519bff44804b9de7a619af75e3d99770..8288f1ebeada0fbb6ae4972c3a8704fe9c14e044 100644 (file)
@@ -1323,6 +1323,9 @@ int unicode_decode_call_errorhandler(const char *errors, PyObject **errorHandler
     *input = PyBytes_AS_STRING(inputobj);
     insize = PyBytes_GET_SIZE(inputobj);
     *inend = *input + insize;
+    /* we can DECREF safely, as the exception has another reference,
+       so the object won't go away. */
+    Py_DECREF(inputobj);
 
     if (newpos<0)
        newpos = insize+newpos;