com php-src: - Fixed possible memleak: phpdbg_prompt.c

From: Date: Sat, 16 Nov 2013 12:02:35 +0000
Subject: com php-src: - Fixed possible memleak: phpdbg_prompt.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-74922@lists.php.net to get a copy of this message
Commit: bff5abfd951981ab41102800b1b5554cf0f48760 Author: Felipe Pena <felipensp@gmail.com> Sat, 16 Nov 2013 10:02:35 -0200 Parents: 515f7806c55f0005c441703f1f65f5e7746782d9 Branches: PHP-5.6 Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=bff5abfd951981ab41102800b1b5554cf0f48760 Log: - Fixed possible memleak Changed paths: M phpdbg_prompt.c Diff: diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index 8c9b4d5..58e37ad 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -708,7 +708,7 @@ int phpdbg_do_cmd(const phpdbg_command_t *command, char *cmd_line, size_t cmd_le int phpdbg_interactive(TSRMLS_D) /* {{{ */ { size_t cmd_len; - int cmd_type; + int ret = SUCCESS; #ifndef HAVE_LIBREADLINE char cmd[PHPDBG_MAX_CMD]; @@ -737,7 +737,7 @@ int phpdbg_interactive(TSRMLS_D) /* {{{ */ add_history(cmd); #endif - switch (cmd_type = phpdbg_do_cmd(phpdbg_prompt_commands, cmd, cmd_len TSRMLS_CC)) { + switch (ret = phpdbg_do_cmd(phpdbg_prompt_commands, cmd, cmd_len TSRMLS_CC)) { case FAILURE: if (!(PHPDBG_G(flags) & PHPDBG_IS_QUITTING)) { phpdbg_error("Failed to execute %s!", cmd); @@ -749,13 +749,7 @@ int phpdbg_interactive(TSRMLS_D) /* {{{ */ if (!EG(in_execution)) { phpdbg_error("Not running"); } - -#ifdef HAVE_LIBREADLINE - if (cmd) { - free(cmd); - } -#endif - return cmd_type; + goto out; } } @@ -766,18 +760,20 @@ int phpdbg_interactive(TSRMLS_D) /* {{{ */ } #endif } else if (PHPDBG_G(last)) { - return PHPDBG_G(last)->handler( - PHPDBG_G(last_params), PHPDBG_G(last_params_len) TSRMLS_CC); + ret = PHPDBG_G(last)->handler( + PHPDBG_G(last_params), PHPDBG_G(last_params_len) TSRMLS_CC); + + goto out; } } - +out: #ifdef HAVE_LIBREADLINE if (cmd) { free(cmd); } #endif - return SUCCESS; + return ret; } /* }}} */ void phpdbg_print_opline(zend_execute_data *execute_data, zend_bool ignore_flags TSRMLS_DC) /* {{{ */

« previous php.cvs (#74922) next »