Skip to content

Commit 23e9d8b

Browse files
committed
Merge branch 'PHP-8.4'
* PHP-8.4: Fix some leaks in php_scandir
2 parents 864ad1b + 29a5adc commit 23e9d8b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

main/php_scandir.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ PHPAPI int php_scandir(const char *dirname, struct dirent **namelist[], int (*se
8383

8484
newv = (struct dirent **) realloc (vector, vector_size * sizeof (struct dirent *));
8585
if (!newv) {
86-
return -1;
86+
goto fail;
8787
}
8888
vector = newv;
8989
}
@@ -113,6 +113,7 @@ PHPAPI int php_scandir(const char *dirname, struct dirent **namelist[], int (*se
113113
free(vector[nfiles]);
114114
}
115115
free(vector);
116+
closedir(dirp);
116117
return -1;
117118
}
118119
#endif

0 commit comments

Comments
 (0)