cvs: php-src(PHP_4_3) /main php_ini.c
| From: | Derick Rethans | Date: | Mon, 16 Feb 2004 14:29:08 +0000 |
| Subject: | cvs: php-src(PHP_4_3) /main php_ini.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-26224@lists.php.net to get a copy of this message | ||
derick Mon Feb 16 09:29:08 2004 EDT
Modified files: (Branch: PHP_4_3)
/php-src/main php_ini.c
Log:
- MFH: Fixed zero bytes memory allocation when no extra ini files are found in
the --with-config-file-scan-dir specified directory. (Eric Colinet, Derick)
http://cvs.php.net/diff.php/php-src/main/php_ini.c?r1=1.106.2.12&r2=1.106.2.13&ty=u
Index: php-src/main/php_ini.c
diff -u php-src/main/php_ini.c:1.106.2.12 php-src/main/php_ini.c:1.106.2.13
--- php-src/main/php_ini.c:1.106.2.12 Fri May 30 21:37:44 2003
+++ php-src/main/php_ini.c Mon Feb 16 09:29:07 2004
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_ini.c,v 1.106.2.12 2003/05/31 01:37:44 sniper Exp $ */
+/* $Id: php_ini.c,v 1.106.2.13 2004/02/16 14:29:07 derick Exp $ */
/* Check CWD for php.ini */
#define INI_CHECK_CWD
@@ -441,12 +441,14 @@
* 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");
- }
+ 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);
}
}