diff options
author | Christian Heimes <christian@cheimes.de> | 2012-09-10 00:00:34 (GMT) |
---|---|---|
committer | Christian Heimes <christian@cheimes.de> | 2012-09-10 00:00:34 (GMT) |
commit | 1b5c76a2832e3fc3eb4d850b5bc69692bf23c83a (patch) | |
tree | 429cb4c78070a8d56e7faaaae26a081069f90f4d /Modules | |
parent | 15b6885fe0ac67a23bbf80f90b1854c3bd7db984 (diff) | |
download | cpython-1b5c76a2832e3fc3eb4d850b5bc69692bf23c83a.zip cpython-1b5c76a2832e3fc3eb4d850b5bc69692bf23c83a.tar.gz cpython-1b5c76a2832e3fc3eb4d850b5bc69692bf23c83a.tar.bz2 |
Fixed two memory leaks in make_filename() in zipimport.c. The allocated buffer wasn't cleaned up in two error cases. CID 486832
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/zipimport.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Modules/zipimport.c b/Modules/zipimport.c index 12bfe23..ccbc784 100644 --- a/Modules/zipimport.c +++ b/Modules/zipimport.c @@ -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; |