[Python-checkins] python/dist/src/Modules posixmodule.c,2.288,2.289
jvr@users.sourceforge.net
jvr@users.sourceforge.net
Mon, 03 Mar 2003 11:07:16 -0800
Update of /cvsroot/python/python/dist/src/Modules
In directory sc8-pr-cvs1:/tmp/cvs-serv32165/Modules
Modified Files:
posixmodule.c
Log Message:
plugged leak noted by nnorwitz: the 'et' format returns allocated memory
Index: posixmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/posixmodule.c,v
retrieving revision 2.288
retrieving revision 2.289
diff -C2 -d -r2.288 -r2.289
*** posixmodule.c 3 Mar 2003 17:32:13 -0000 2.288
--- posixmodule.c 3 Mar 2003 19:07:13 -0000 2.289
***************
*** 1772,1776 ****
#else
! char *name;
PyObject *d, *v;
DIR *dirp;
--- 1772,1776 ----
#else
! char *name = NULL;
PyObject *d, *v;
DIR *dirp;
***************
*** 1785,1792 ****
return NULL;
if ((dirp = opendir(name)) == NULL) {
! return posix_error_with_filename(name);
}
if ((d = PyList_New(0)) == NULL) {
closedir(dirp);
return NULL;
}
--- 1785,1793 ----
return NULL;
if ((dirp = opendir(name)) == NULL) {
! return posix_error_with_allocated_filename(name);
}
if ((d = PyList_New(0)) == NULL) {
closedir(dirp);
+ PyMem_Free(name);
return NULL;
}
***************
*** 1827,1830 ****
--- 1828,1832 ----
}
closedir(dirp);
+ PyMem_Free(name);
return d;