summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArnold D. Robbins <arnold@skeeve.com>2022-09-30 12:59:47 +0300
committerArnold D. Robbins <arnold@skeeve.com>2022-09-30 12:59:47 +0300
commitbc8957f4f5e1aafd00c82b52f4c82997b7cfc183 (patch)
tree093f295aab69d1ac75c64d63f9a43da0af52cdc9
parent53d97efad03453b0fff5a941170db6b7abdb2083 (diff)
downloadgawk-bc8957f4f5e1aafd00c82b52f4c82997b7cfc183.tar.gz
Fix a memory leak.
-rw-r--r--ChangeLog6
-rw-r--r--interpret.h3
2 files changed, 9 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index bfa22e2b..519facfb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2022-09-30 Arnold D. Robbins <arnold@skeeve.com>
+
+ * interpret.h (r_interpret): For the `push' opcodes with
+ Node_elem_new, deref `m' before assigning m = dupnode(Nnull_string).
+ Thanks to Andrew Schorr and valgrind for the report.
+
2022-09-23 Arnold D. Robbins <arnold@skeeve.com>
* interpret.h (r_interpret): For the `push' opcodes with
diff --git a/interpret.h b/interpret.h
index fde02d2d..f703080d 100644
--- a/interpret.h
+++ b/interpret.h
@@ -217,6 +217,7 @@ uninitialized_scalar:
m->type = Node_var;
m->var_value = dupnode(Nnull_string);
}
+
if (do_lint)
lintwarn(isparam ?
_("reference to uninitialized argument `%s'") :
@@ -235,6 +236,7 @@ uninitialized_scalar:
m->type = Node_var;
m->var_value = dupnode(Nnull_string);
}
+
if (do_lint)
lintwarn(isparam ?
_("reference to uninitialized argument `%s'") :
@@ -242,6 +244,7 @@ uninitialized_scalar:
save_symbol->vname);
// set up local param by value
if (op != Op_push_arg_untyped) {
+ DEREF(m);
m = dupnode(Nnull_string);
}