Fix memory leaks when parsing function calls
For function calls when calling the PECallFunction() constructor a copy is made of the argument expression list. This means the original list should be deleted within the rule. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
This commit is contained in:
parent
fd69d4e09c
commit
f9aadc13b5
4
parse.y
4
parse.y
|
|
@ -3704,6 +3704,7 @@ expr_primary
|
|||
PECallFunction*tmp = pform_make_call_function(@1, *$1, *expr_list);
|
||||
delete $1;
|
||||
delete $2;
|
||||
delete expr_list;
|
||||
$$ = tmp;
|
||||
}
|
||||
| class_hierarchy_identifier '(' expression_list_with_nuls ')'
|
||||
|
|
@ -3711,6 +3712,7 @@ expr_primary
|
|||
strip_tail_items(expr_list);
|
||||
PECallFunction*tmp = pform_make_call_function(@1, *$1, *expr_list);
|
||||
delete $1;
|
||||
delete expr_list;
|
||||
$$ = tmp;
|
||||
}
|
||||
| SYSTEM_IDENTIFIER '(' expression_list_proper ')'
|
||||
|
|
@ -3718,6 +3720,7 @@ expr_primary
|
|||
PECallFunction*tmp = new PECallFunction(tn, *$3);
|
||||
FILE_NAME(tmp, @1);
|
||||
delete[]$1;
|
||||
delete $3;
|
||||
$$ = tmp;
|
||||
}
|
||||
| PACKAGE_IDENTIFIER K_SCOPE_RES IDENTIFIER '(' expression_list_proper ')'
|
||||
|
|
@ -3725,6 +3728,7 @@ expr_primary
|
|||
PECallFunction*tmp = new PECallFunction($1, use_name, *$5);
|
||||
FILE_NAME(tmp, @3);
|
||||
delete[]$3;
|
||||
delete $5;
|
||||
$$ = tmp;
|
||||
}
|
||||
| SYSTEM_IDENTIFIER '(' ')'
|
||||
|
|
|
|||
Loading…
Reference in New Issue