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

Skip to content

Commit 36f938f

Browse files
committed
Fix refleak: decref inputobj after extracting the relavant info (the object
won't go away, as the exception object holds another reference).
1 parent cccc58d commit 36f938f

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

Objects/unicodeobject.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1323,6 +1323,9 @@ int unicode_decode_call_errorhandler(const char *errors, PyObject **errorHandler
13231323
*input = PyBytes_AS_STRING(inputobj);
13241324
insize = PyBytes_GET_SIZE(inputobj);
13251325
*inend = *input + insize;
1326+
/* we can DECREF safely, as the exception has another reference,
1327+
so the object won't go away. */
1328+
Py_DECREF(inputobj);
13261329

13271330
if (newpos<0)
13281331
newpos = insize+newpos;

0 commit comments

Comments
 (0)