Browse Source

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

PHP-5.0
Ilia Alshanetsky 22 years ago
parent
commit
ccc580f408
  1. 9
      win32/readdir.c

9
win32/readdir.c

@ -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);

Loading…
Cancel
Save