mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fix a few valgrind errors in phpdbg
This commit is contained in:
parent
34596a3ddd
commit
b5e16cebda
4 changed files with 679 additions and 775 deletions
|
@ -1878,7 +1878,7 @@ TEST $file
|
|||
|
||||
if (version_compare($valgrind_version, '3.3.0', '>=')) {
|
||||
/* valgrind 3.3.0+ doesn't have --log-file-exactly option */
|
||||
$cmd = "valgrind -q --tool=memcheck --trace-children=yes --log-file=$memcheck_filename $cmd";
|
||||
$cmd = "valgrind -q --tool=memcheck --trace-children=yes --show-leak-kinds=definite,indirect --log-file=$memcheck_filename $cmd";
|
||||
} else {
|
||||
$cmd = "valgrind -q --tool=memcheck --trace-children=yes --log-file-exactly=$memcheck_filename $cmd";
|
||||
}
|
||||
|
@ -1933,7 +1933,7 @@ COMMAND $cmd
|
|||
$passed = false;
|
||||
|
||||
if ($leak_check) { // leak check
|
||||
$leaked = filesize($memcheck_filename) > 0;
|
||||
$leaked = filesize($memcheck_filename) > 367;
|
||||
|
||||
if (!$leaked) {
|
||||
@unlink($memcheck_filename);
|
||||
|
|
|
@ -385,23 +385,27 @@ PHPDBG_API void phpdbg_stack_free(phpdbg_param_t *stack) {
|
|||
switch (remove->type) {
|
||||
case NUMERIC_METHOD_PARAM:
|
||||
case METHOD_PARAM:
|
||||
if (remove->method.class)
|
||||
free(remove->method.class);
|
||||
if (remove->method.name)
|
||||
free(remove->method.name);
|
||||
if (remove->method.class) {
|
||||
efree(remove->method.class);
|
||||
}
|
||||
if (remove->method.name) {
|
||||
efree(remove->method.name);
|
||||
}
|
||||
break;
|
||||
|
||||
case NUMERIC_FUNCTION_PARAM:
|
||||
case STR_PARAM:
|
||||
case OP_PARAM:
|
||||
if (remove->str)
|
||||
free(remove->str);
|
||||
if (remove->str) {
|
||||
efree(remove->str);
|
||||
}
|
||||
break;
|
||||
|
||||
case NUMERIC_FILE_PARAM:
|
||||
case FILE_PARAM:
|
||||
if (remove->file.name)
|
||||
free(remove->file.name);
|
||||
if (remove->file.name) {
|
||||
efree(remove->file.name);
|
||||
}
|
||||
break;
|
||||
|
||||
default: {
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -57,7 +57,7 @@ T_SHELL 'sh'
|
|||
T_IF 'if'
|
||||
T_RUN 'run'
|
||||
T_RUN_SHORT "r"
|
||||
WS [ \r\n\t]+
|
||||
WS [ \r\t]+
|
||||
DIGITS [-]?[0-9\.]+
|
||||
ID [^ \r\n\t:#\000]+
|
||||
GENERIC_ID ([^ \r\n\t:#\000]|":\\")+
|
||||
|
@ -67,7 +67,7 @@ INPUT [^\n\000]+
|
|||
|
||||
<!*> := yyleng = (size_t) YYCURSOR - (size_t) yytext;
|
||||
|
||||
<*>{WS}?[\n\000] {
|
||||
<*>[\n\000] {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -96,7 +96,7 @@ INPUT [^\n\000]+
|
|||
|
||||
<NORMAL>{ID}"://" {
|
||||
phpdbg_init_param(yylval, STR_PARAM);
|
||||
yylval->str = zend_strndup(yytext, yyleng);
|
||||
yylval->str = estrndup(yytext, yyleng);
|
||||
yylval->len = yyleng;
|
||||
return T_PROTO;
|
||||
}
|
||||
|
@ -127,21 +127,21 @@ INPUT [^\n\000]+
|
|||
|
||||
<NORMAL>{OPCODE} {
|
||||
phpdbg_init_param(yylval, OP_PARAM);
|
||||
yylval->str = zend_strndup(yytext, yyleng);
|
||||
yylval->str = estrndup(yytext, yyleng);
|
||||
yylval->len = yyleng;
|
||||
return T_OPCODE;
|
||||
}
|
||||
|
||||
<NORMAL>{GENERIC_ID} {
|
||||
phpdbg_init_param(yylval, STR_PARAM);
|
||||
yylval->str = zend_strndup(yytext, yyleng);
|
||||
yylval->str = estrndup(yytext, yyleng);
|
||||
yylval->len = yyleng;
|
||||
return T_ID;
|
||||
}
|
||||
|
||||
<RAW>{INPUT} {
|
||||
phpdbg_init_param(yylval, STR_PARAM);
|
||||
yylval->str = zend_strndup(yytext, yyleng);
|
||||
yylval->str = estrndup(yytext, yyleng);
|
||||
yylval->len = yyleng;
|
||||
return T_INPUT;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue