Skip to content

Commit 29a5adc

Browse files
committed
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3: Fix some leaks in php_scandir
2 parents 1a1a83f + 81d9a27 commit 29a5adc

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

NEWS

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ PHP NEWS
1111
hooks). (ilutov)
1212
. Fixed bug GH-18304 (Changing the properties of a DateInterval through
1313
dynamic properties triggers a SegFault). (nielsdos)
14+
. Fix some leaks in php_scandir. (nielsdos)
1415

1516
- DBA:
1617
. FIxed bug GH-18247 dba_popen() memory leak on invalid path. (David Carlier)

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)