From 76e3e99dd674fe98130ba110564c607b12a7772c Mon Sep 17 00:00:00 2001 From: Bob Weinand Date: Fri, 21 Aug 2015 23:36:31 +0100 Subject: Fix issues with phpdbg SIGINT handler Also fix valgrind warnings in allocator when not using mmap()ed memory --- sapi/phpdbg/phpdbg_cmd.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'sapi/phpdbg/phpdbg_cmd.c') diff --git a/sapi/phpdbg/phpdbg_cmd.c b/sapi/phpdbg/phpdbg_cmd.c index a50b340e7d..ed4cf3b6d6 100644 --- a/sapi/phpdbg/phpdbg_cmd.c +++ b/sapi/phpdbg/phpdbg_cmd.c @@ -768,16 +768,14 @@ PHPDBG_API char *phpdbg_read_input(char *buffered) /* {{{ */ if (buffer && strlen(buffer)) { if (PHPDBG_G(buffer)) { - efree(PHPDBG_G(buffer)); + free(PHPDBG_G(buffer)); } - PHPDBG_G(buffer) = estrdup(buffer); - } else { - if (PHPDBG_G(buffer)) { - if (buffer) { - efree(buffer); - } - buffer = estrdup(PHPDBG_G(buffer)); + PHPDBG_G(buffer) = strdup(buffer); + } else if (PHPDBG_G(buffer)) { + if (buffer) { + efree(buffer); } + buffer = estrdup(PHPDBG_G(buffer)); } return buffer; -- cgit v1.2.1