summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2004-06-09 01:46:02 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2004-06-09 01:46:02 (GMT)
commit2adf2109938bcdf7c527ade6ba8b5d631080e115 (patch)
tree20460ef27087ac4548a9c85fe5862bebd36a42a4 /Modules
parent4182cfd7dba40383ebf9e5a14b27de934827a674 (diff)
downloadcpython-2adf2109938bcdf7c527ade6ba8b5d631080e115.zip
cpython-2adf2109938bcdf7c527ade6ba8b5d631080e115.tar.gz
cpython-2adf2109938bcdf7c527ade6ba8b5d631080e115.tar.bz2
Ensure path is initialized to prevent freeing random memory
(reported by Thomas Heller). If have_unicode_filename is set, path looks like it will not be used, so there's no need to free it.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/posixmodule.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/Modules/posixmodule.c b/Modules/posixmodule.c
index 599d88a..a375dcb 100644
--- a/Modules/posixmodule.c
+++ b/Modules/posixmodule.c
@@ -1994,7 +1994,7 @@ second form is used, set the access and modified times to the current time.");
static PyObject *
posix_utime(PyObject *self, PyObject *args)
{
- char *path;
+ char *path = NULL;
long atime, mtime, ausec, musec;
int res;
PyObject* arg;
@@ -2087,10 +2087,8 @@ posix_utime(PyObject *self, PyObject *args)
}
if (res < 0) {
#ifdef Py_WIN_WIDE_FILENAMES
- if (have_unicode_filename) {
- PyMem_Free(path);
+ if (have_unicode_filename)
return posix_error_with_unicode_filename(wpath);
- }
#endif /* Py_WIN_WIDE_FILENAMES */
return posix_error_with_allocated_filename(path);
}