Skip to content
Browse files

- Fixed zero bytes memory allocation when no extra ini files are foun…

…d in the

  --with-config-file-scan-dir specified directory. (patch by Eric Colinet
  <e.colinet@laposte.net>)
  • Loading branch information...
1 parent ee42c23 commit 3781af53cd6ec7b68a3bb8469556aae6166e0c54 Derick Rethans committed Feb 14, 2004
Showing with 11 additions and 7 deletions.
  1. +2 −0 NEWS
  2. +9 −7 main/php_ini.c
View
2 NEWS
@@ -1,6 +1,8 @@
PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2004, PHP 5 Release Candidate 1
+- Fixed zero bytes memory allocation when no extra ini files are found in the
+ --with-config-file-scan-dir specified directory. (Eric Colinet, Derick)
- Fixed start-up problem if both SPL and SimpleXML were enabled. The double
initialization of apache 1.3 was causing problems here. (Marcus, Derick)
View
16 main/php_ini.c
@@ -512,13 +512,15 @@ int php_init_config()
* Don't need an extra byte for the \0 in this malloc as the last
* element will not get a trailing , which gives us the byte for the \0
*/
- php_ini_scanned_files = (char *) malloc(total_l);
- *php_ini_scanned_files = '\0';
- for (element = scanned_ini_list.head; element; element = element->next) {
- strcat(php_ini_scanned_files, *(char **)element->data);
- strcat(php_ini_scanned_files, element->next ? ",\n" : "\n");
- }
- zend_llist_destroy(&scanned_ini_list);
+ if (total_l) {
+ php_ini_scanned_files = (char *) malloc(total_l);
+ *php_ini_scanned_files = '\0';
+ for (element = scanned_ini_list.head; element; element = element->next) {
+ strcat(php_ini_scanned_files, *(char **)element->data);
+ strcat(php_ini_scanned_files, element->next ? ",\n" : "\n");
+ }
+ zend_llist_destroy(&scanned_ini_list);
+ }
}
}
return SUCCESS;

0 comments on commit 3781af5

Please sign in to comment.
Something went wrong with that request. Please try again.