diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c --- a/Modules/_io/textio.c +++ b/Modules/_io/textio.c @@ -435,6 +435,7 @@ } Py_DECREF(output); output = PyUnicode_FromKindAndData(kind, translated, out); + PyMem_Free(translated); if (!output) goto error; } diff --git a/Python/import.c b/Python/import.c --- a/Python/import.c +++ b/Python/import.c @@ -1062,7 +1062,7 @@ */ right = rightmost_sep(pathname); if (right == NULL) - return NULL; + goto error; sep = *right; *right = '0円'; left = rightmost_sep(pathname);