1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fixed memory leak on error in win32's opendir() emulation. (Patch by Wez)

This commit is contained in:
Ilia Alshanetsky
2004-06-09 14:18:14 +00:00
parent 1f73efcaab
commit ccc580f408

View File

@@ -37,14 +37,17 @@ DIR *opendir(const char *dir)
dp = (DIR *) malloc(sizeof(DIR));
dp->offset = 0;
dp->finished = 0;
dp->dir = strdup(dir);
if ((handle = _findfirst(filespec, &(dp->fileinfo))) < 0) {
if (errno == ENOENT)
if (errno == ENOENT) {
dp->finished = 1;
else
} else {
free(dp);
free(filespec);
return NULL;
}
}
dp->dir = strdup(dir);
dp->handle = handle;
free(filespec);