com php-src: Fix invalid efree() on null pointer and add help for -x: phpdbg_help.c phpdbg_utils.c
| From: | Bob Weinand | Date: | Tue, 14 Oct 2014 07:16:30 +0000 |
| Subject: | com php-src: Fix invalid efree() on null pointer and add help for -x: phpdbg_help.c phpdbg_utils.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-82560@lists.php.net to get a copy of this message | ||
Commit: c812ee9c3556c0ea797627c86a0a650c65f9908b
Author: Bob Weinand <bobwei9@hotmail.com> Tue, 14 Oct 2014 09:16:30 +0200
Parents: 1486a9ebf7c42120fb5dd3e12a8de44fe1527ed7
Branches: PHP-5.6
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=c812ee9c3556c0ea797627c86a0a650c65f9908b
Log:
Fix invalid efree() on null pointer and add help for -x
Changed paths:
M phpdbg_help.c
M phpdbg_utils.c
Diff:
diff --git a/phpdbg_help.c b/phpdbg_help.c
index 29087e0..2990edd 100644
--- a/phpdbg_help.c
+++ b/phpdbg_help.c
@@ -133,10 +133,10 @@ void pretty_print(char *text TSRMLS_DC)
*q++ = '\0';
if ((q-new)>size) {
- phpdbg_error("help", "overrun=\"%lu\"", "Output overrun of %lu
bytes", ((q-new) - size));
+ phpdbg_error("help", "overrun=\"%lu\"", "Output overrun of %lu
bytes", ((q - new) - size));
}
- phpdbg_out("%s", new);
+ phpdbg_out("%s\n", new);
efree(new);
} /* }}} */
@@ -387,6 +387,7 @@ phpdbg_help_text_t phpdbg_help_text[] = {
" **-S** **-S**cli Override SAPI name, careful!" CR
" **-l** **-l**4000 Setup remote console ports" CR
" **-a** **-a**192.168.0.3 Setup remote console bind address" CR
+" **-x** Enable xml output (instead of normal text output)" CR
" **-V** Print version number" CR
" **--** **--** arg1 arg2 Use to delimit phpdbg arguments and php $argv; append
any $argv "
"argument after it" CR CR
diff --git a/phpdbg_utils.c b/phpdbg_utils.c
index c631d8f5..27b75b2 100644
--- a/phpdbg_utils.c
+++ b/phpdbg_utils.c
@@ -1290,8 +1290,10 @@ PHPDBG_API int phpdbg_vprint(int type TSRMLS_DC, int fd, const char *tag,
const
PHPDBG_G(err_buf).tag = estrdup(tag);
PHPDBG_G(err_buf).msg = msg;
PHPDBG_G(err_buf).msglen = msglen;
- PHPDBG_G(err_buf).xml = xml;
- PHPDBG_G(err_buf).xmllen = xmllen;
+ if (PHPDBG_G(flags) & PHPDBG_WRITE_XML) {
+ PHPDBG_G(err_buf).xml = xml;
+ PHPDBG_G(err_buf).xmllen = xmllen;
+ }
return msglen;
}
@@ -1318,7 +1320,9 @@ PHPDBG_API void phpdbg_free_err_buf(TSRMLS_D) {
efree(PHPDBG_G(err_buf).tag);
efree(PHPDBG_G(err_buf).msg);
- efree(PHPDBG_G(err_buf).xml);
+ if (PHPDBG_G(flags) & PHPDBG_WRITE_XML) {
+ efree(PHPDBG_G(err_buf).xml);
+ }
}
PHPDBG_API void phpdbg_activate_err_buf(zend_bool active TSRMLS_DC) {