Merge branch 'PHP-8.3' into PHP-8.4

* PHP-8.3:
  Fix some leaks in php_scandir
This commit is contained in:
Niels Dossche 2025-04-21 13:21:12 +02:00
commit 29a5adc6af
No known key found for this signature in database
GPG key ID: B8A8AD166DF0E2E5
2 changed files with 3 additions and 1 deletions

1
NEWS
View file

@ -11,6 +11,7 @@ PHP NEWS
hooks). (ilutov) hooks). (ilutov)
. Fixed bug GH-18304 (Changing the properties of a DateInterval through . Fixed bug GH-18304 (Changing the properties of a DateInterval through
dynamic properties triggers a SegFault). (nielsdos) dynamic properties triggers a SegFault). (nielsdos)
. Fix some leaks in php_scandir. (nielsdos)
- DBA: - DBA:
. FIxed bug GH-18247 dba_popen() memory leak on invalid path. (David Carlier) . FIxed bug GH-18247 dba_popen() memory leak on invalid path. (David Carlier)

View file

@ -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 *)); newv = (struct dirent **) realloc (vector, vector_size * sizeof (struct dirent *));
if (!newv) { if (!newv) {
return -1; goto fail;
} }
vector = newv; vector = newv;
} }
@ -113,6 +113,7 @@ fail:
free(vector[nfiles]); free(vector[nfiles]);
} }
free(vector); free(vector);
closedir(dirp);
return -1; return -1;
} }
#endif #endif