From: Felipe Pena Date: Mon, 18 Nov 2013 21:55:29 +0000 (-0200) Subject: - Fix valgrind reports + CS X-Git-Tag: php-5.6.0alpha1~110^2~223^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=89514066787a1201bc4c4474cf78f21225ca412c;p=php - Fix valgrind reports + CS --- diff --git a/phpdbg.c b/phpdbg.c index eaa626d39a..6659075a0d 100644 --- a/phpdbg.c +++ b/phpdbg.c @@ -41,6 +41,7 @@ static inline void php_phpdbg_globals_ctor(zend_phpdbg_globals *pg) /* {{{ */ pg->lcmd = NULL; pg->flags = PHPDBG_DEFAULT_FLAGS; pg->oplog = NULL; + memset(&pg->lparam, 0, sizeof(phpdbg_param_t)); } /* }}} */ static PHP_MINIT_FUNCTION(phpdbg) /* {{{ */ @@ -94,14 +95,14 @@ static void php_phpdbg_destroy_bp_condition(void *data) /* {{{ */ } /* }}} */ static PHP_RINIT_FUNCTION(phpdbg) /* {{{ */ -{ +{ zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_FILE], 8, NULL, php_phpdbg_destroy_bp_file, 0); zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_SYM], 8, NULL, php_phpdbg_destroy_bp_symbol, 0); zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_OPLINE], 8, NULL, NULL, 0); zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD], 8, NULL, php_phpdbg_destroy_bp_methods, 0); zend_hash_init(&PHPDBG_G(bp)[PHPDBG_BREAK_COND], 8, NULL, php_phpdbg_destroy_bp_condition, 0); zend_hash_init(&PHPDBG_G(seek), 8, NULL, NULL, 0); - + return SUCCESS; } /* }}} */ @@ -113,7 +114,7 @@ static PHP_RSHUTDOWN_FUNCTION(phpdbg) /* {{{ */ zend_hash_destroy(&PHPDBG_G(bp)[PHPDBG_BREAK_METHOD]); zend_hash_destroy(&PHPDBG_G(bp)[PHPDBG_BREAK_COND]); zend_hash_destroy(&PHPDBG_G(seek)); - + if (PHPDBG_G(exec)) { efree(PHPDBG_G(exec)); PHPDBG_G(exec) = NULL; diff --git a/phpdbg_list.c b/phpdbg_list.c index dcce374630..241983d742 100644 --- a/phpdbg_list.c +++ b/phpdbg_list.c @@ -153,7 +153,7 @@ void phpdbg_list_file(const char *filename, long count, long offset, int highlig return; } - last_pos = mem = mmap(0, st.st_size, PROT_READ, MAP_SHARED, fd, 0); + pos = last_pos = mem = mmap(0, st.st_size, PROT_READ, MAP_SHARED, fd, 0); end_pos = mem + st.st_size; #else @@ -170,7 +170,7 @@ void phpdbg_list_file(const char *filename, long count, long offset, int highlig return; } - last_pos = mem = (char*) MapViewOfFile(map, FILE_MAP_READ, 0, 0, 0); + pos = last_pos = mem = (char*) MapViewOfFile(map, FILE_MAP_READ, 0, 0, 0); if (mem == NULL) { phpdbg_error("Failed to map file in memory"); CloseHandle(map); diff --git a/phpdbg_print.c b/phpdbg_print.c index 606e091021..f3821bee1e 100644 --- a/phpdbg_print.c +++ b/phpdbg_print.c @@ -37,7 +37,8 @@ PHPDBG_PRINT(opline) /* {{{ */ return SUCCESS; } /* }}} */ -static inline void phpdbg_print_function_helper(zend_function *method TSRMLS_DC) { +static inline void phpdbg_print_function_helper(zend_function *method TSRMLS_DC) /* {{{ */ +{ switch (method->type) { case ZEND_USER_FUNCTION: { zend_op_array* op_array = &method->op_array; @@ -85,7 +86,7 @@ static inline void phpdbg_print_function_helper(zend_function *method TSRMLS_DC) } } } -} +} /* }}} */ PHPDBG_PRINT(exec) /* {{{ */ {