mirror of
https://github.com/python/cpython.git
synced 2025-08-02 16:13:13 +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;
|
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;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue