diff --git a/NEWS b/NEWS index 720f0bbc6bc..0790cae9530 100644 --- a/NEWS +++ b/NEWS @@ -11,6 +11,7 @@ PHP NEWS hooks). (ilutov) . Fixed bug GH-18304 (Changing the properties of a DateInterval through dynamic properties triggers a SegFault). (nielsdos) + . Fix some leaks in php_scandir. (nielsdos) - DBA: . FIxed bug GH-18247 dba_popen() memory leak on invalid path. (David Carlier) diff --git a/main/php_scandir.c b/main/php_scandir.c index 7d1eb360236..7bf91bdf7f3 100644 --- a/main/php_scandir.c +++ b/main/php_scandir.c @@ -83,7 +83,7 @@ PHPAPI int php_scandir(const char *dirname, struct dirent **namelist[], int (*se newv = (struct dirent **) realloc (vector, vector_size * sizeof (struct dirent *)); if (!newv) { - return -1; + goto fail; } vector = newv; } @@ -113,6 +113,7 @@ fail: free(vector[nfiles]); } free(vector); + closedir(dirp); return -1; } #endif