Kaydet (Commit) 1b5c76a2 authored tarafından Christian Heimes's avatar Christian Heimes

Fixed two memory leaks in make_filename() in zipimport.c. The allocated buffer…

Fixed two memory leaks in make_filename() in zipimport.c. The allocated buffer wasn't cleaned up in two error cases. CID 486832
üst 15b6885f
...@@ -236,12 +236,16 @@ make_filename(PyObject *prefix, PyObject *name) ...@@ -236,12 +236,16 @@ make_filename(PyObject *prefix, PyObject *name)
return NULL; return NULL;
} }
if (!PyUnicode_AsUCS4(prefix, p, len, 0)) if (!PyUnicode_AsUCS4(prefix, p, len, 0)) {
PyMem_Free(buf);
return NULL; return NULL;
}
p += PyUnicode_GET_LENGTH(prefix); p += PyUnicode_GET_LENGTH(prefix);
len -= PyUnicode_GET_LENGTH(prefix); len -= PyUnicode_GET_LENGTH(prefix);
if (!PyUnicode_AsUCS4(name, p, len, 1)) if (!PyUnicode_AsUCS4(name, p, len, 1)) {
PyMem_Free(buf);
return NULL; return NULL;
}
for (; *p; p++) { for (; *p; p++) {
if (*p == '.') if (*p == '.')
*p = SEP; *p = SEP;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment