From 63a0c1ca15f695f648dbed477e8c0dda8c85fdb7 Mon Sep 17 00:00:00 2001 From: krakjoe Date: Wed, 13 Nov 2013 04:34:02 +0000 Subject: [PATCH] ... --- phpdbg_prompt.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index 951fe1d39b..012fdd73cc 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -563,7 +563,7 @@ phpdbg_interactive_enter: #endif /* trim space from end of input */ - while (isspace(cmd[cmd_len-1])) + while (*cmd && isspace(cmd[cmd_len-1])) cmd_len--; /* ensure string is null terminated */ @@ -588,21 +588,29 @@ phpdbg_interactive_enter: return PHPDBG_NEXT; } } - } else if (PHPDBG_G(last)) { - PHPDBG_G(last)->handler( - PHPDBG_G(last_params), PHPDBG_G(last_params_len) TSRMLS_CC); - } - - if (!(PHPDBG_G(flags) & PHPDBG_IS_QUITTING)) { + #ifdef HAVE_LIBREADLINE if (cmd) { free(cmd); cmd = NULL; } #endif + + } else if (PHPDBG_G(last)) { + PHPDBG_G(last)->handler( + PHPDBG_G(last_params), PHPDBG_G(last_params_len) TSRMLS_CC); + } + + if (!(PHPDBG_G(flags) & PHPDBG_IS_QUITTING)) { goto phpdbg_interactive_enter; } } + +#ifdef HAVE_LIBREADLINE + if (cmd) { + free(cmd); + } +#endif return SUCCESS; } /* }}} */ -- 2.50.1