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

Skip to content

Commit 0ebeb58

Browse files
committed
PyUnicode_FromEncodedObject(): Repair memory leak in an error case.
1 parent c636f56 commit 0ebeb58

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Objects/unicodeobject.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -424,13 +424,13 @@ PyObject *PyUnicode_FromEncodedObject(register PyObject *obj,
424424
owned = 1;
425425
}
426426
if (PyUnicode_Check(obj)) {
427-
Py_INCREF(obj);
428-
v = obj;
429427
if (encoding) {
430428
PyErr_SetString(PyExc_TypeError,
431429
"decoding Unicode is not supported");
432430
return NULL;
433431
}
432+
Py_INCREF(obj);
433+
v = obj;
434434
goto done;
435435
}
436436
else if (PyString_Check(obj)) {

0 commit comments

Comments
 (0)