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)
return NULL;
}
if (!PyUnicode_AsUCS4(prefix, p, len, 0))
if (!PyUnicode_AsUCS4(prefix, p, len, 0)) {
PyMem_Free(buf);
return NULL;
}
p += 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;
}
for (; *p; p++) {
if (*p == '.')
*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