mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Fixed two memory leaks in make_filename() in zipimport.c. The allocated buffer wasn't cleaned up in two error cases. CID 486832
This commit is contained in:
parent
15b6885fe0
commit
1b5c76a283
1 changed files with 6 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue