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:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user