diff options
author | Bob Weinand <bobwei9@hotmail.com> | 2014-04-15 15:52:46 +0000 |
---|---|---|
committer | Bob Weinand <bobwei9@hotmail.com> | 2014-04-15 15:52:46 +0000 |
commit | 0e8637441c10c1a028d9c4619d32bb8ce9cb3ce4 (patch) | |
tree | bc66c4d8af2a93eef1c080eecc7862e3a59e33e1 /phpdbg_prompt.c | |
parent | 9b05f5d1327aff7f828ba21e705f6a1da306059e (diff) | |
download | php-git-0e8637441c10c1a028d9c4619d32bb8ce9cb3ce4.tar.gz |
Fixed segfault when input == NULL
Diffstat (limited to 'phpdbg_prompt.c')
-rw-r--r-- | phpdbg_prompt.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/phpdbg_prompt.c b/phpdbg_prompt.c index 9a9f45b8fa..86fc4d718e 100644 --- a/phpdbg_prompt.c +++ b/phpdbg_prompt.c @@ -1023,18 +1023,18 @@ int phpdbg_interactive(TSRMLS_D) /* {{{ */ char *why = NULL; char *input = NULL; phpdbg_param_t stack; - + PHPDBG_G(flags) |= PHPDBG_IS_INTERACTIVE; input = phpdbg_read_input(NULL TSRMLS_CC); - + if (input) { do { yyscan_t scanner; YY_BUFFER_STATE state; phpdbg_init_param(&stack, STACK_PARAM); - + if (yylex_init(&scanner)) { phpdbg_error( "could not initialize scanner"); @@ -1042,7 +1042,7 @@ int phpdbg_interactive(TSRMLS_D) /* {{{ */ } state = yy_scan_string(input, scanner); - + if (yyparse(&stack, scanner) <= 0) { switch (ret = phpdbg_stack_execute(&stack, &why TSRMLS_CC)) { case FAILURE: @@ -1053,7 +1053,7 @@ int phpdbg_interactive(TSRMLS_D) /* {{{ */ } } } - + if (why) { free(why); why = NULL; @@ -1099,14 +1099,13 @@ last: out: if (input) { + phpdbg_stack_free(&stack); phpdbg_destroy_input(&input TSRMLS_CC); } if (why) { free(why); } - - phpdbg_stack_free(&stack); if (EG(in_execution)) { phpdbg_restore_frame(TSRMLS_C); |