com php-src: don't use emalloc there: phpdbg.c phpdbg_prompt .c
| From: | Bob Weinand | Date: | Wed, 04 Dec 2013 23:26:14 +0000 |
| Subject: | com php-src: don't use emalloc there: phpdbg.c phpdbg_prompt .c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-75317@lists.php.net to get a copy of this message | ||
Commit: 3341e219c9f8b9bb33499f2762103b24bf756da6
Author: krakjoe <joe.watkins@live.co.uk> Wed, 4 Dec 2013 23:26:14 +0000
Parents: 1fb67f1eda02eaad3867fb942e3372edcf17310e
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=3341e219c9f8b9bb33499f2762103b24bf756da6
Log:
don't use emalloc there
Changed paths:
M phpdbg.c
M phpdbg_prompt.c
Diff:
diff --git a/phpdbg.c b/phpdbg.c
index 32cc076..0dcd80e 100644
--- a/phpdbg.c
+++ b/phpdbg.c
@@ -864,9 +864,13 @@ phpdbg_main:
} break;
case 'i': { /* set init file */
+ if (init_file) {
+ free(init_file);
+ }
+
init_file_len = strlen(php_optarg);
if (init_file_len) {
- init_file = estrdup(php_optarg);
+ init_file = strdup(php_optarg);
}
} break;
@@ -975,7 +979,7 @@ phpdbg_main:
memcpy(&ini_entries[ini_entries_len], ze, ze_len);
ini_entries_len += ze_len;
memcpy(&ini_entries[ini_entries_len], "\n", (sizeof("\n") - 1));
-
+
free(zend_extensions[zend_extension]);
zend_extension++;
}
diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c
index 2589a24..a77d27d 100644
--- a/phpdbg_prompt.c
+++ b/phpdbg_prompt.c
@@ -149,7 +149,7 @@ next_line:
}
if (free_init) {
- efree(init_file);
+ free(init_file);
}
}
} /* }}} */
@@ -176,8 +176,9 @@ void phpdbg_init(char *init_file, size_t init_file_len, zend_bool use_default TS
if (i != -1) {
scan_dir[i] = 0;
}
- init_file = emalloc(strlen(scan_dir) + sizeof(PHPDBG_INIT_FILENAME));
- sprintf(init_file, "%s/%s", scan_dir, PHPDBG_INIT_FILENAME);
+
+ asprintf(
+ &init_file, "%s/%s", scan_dir, PHPDBG_INIT_FILENAME);
phpdbg_try_file_init(init_file, strlen(init_file), 1 TSRMLS_CC);
if (i == -1) {
break;