SHA256
3
0
forked from pool/gawk
gawk/double-free.patch

45 lines
1.3 KiB
Diff

diff --git a/interpret.h b/interpret.h
index 57d060e6..26010ada 100644
--- a/interpret.h
+++ b/interpret.h
@@ -213,7 +213,7 @@ top:
case Node_var_new:
uninitialized_scalar:
if (op != Op_push_arg_untyped) {
- /* convert untyped to scalar */
+ /* convert very original untyped to scalar */
m->type = Node_var;
m->var_value = dupnode(Nnull_string);
}
@@ -222,6 +222,7 @@ uninitialized_scalar:
_("reference to uninitialized argument `%s'") :
_("reference to uninitialized variable `%s'"),
save_symbol->vname);
+ // set up local param by value
if (op != Op_push_arg_untyped)
m = dupnode(Nnull_string);
UPREF(m);
@@ -230,14 +231,20 @@ uninitialized_scalar:
case Node_elem_new:
if (op != Op_push_arg_untyped) {
- /* convert untyped to scalar */
- m = elem_new_to_scalar(m);
+ /* convert very original untyped to scalar */
+ m->type = Node_var;
+ m->var_value = dupnode(Nnull_string);
}
if (do_lint)
lintwarn(isparam ?
_("reference to uninitialized argument `%s'") :
_("reference to uninitialized variable `%s'"),
save_symbol->vname);
+ // set up local param by value
+ if (op != Op_push_arg_untyped) {
+ m = dupnode(Nnull_string);
+ }
+
PUSH(m);
break;