diff options
author | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2019-01-14 09:56:14 -0500 |
---|---|---|
committer | Andrew J. Schorr <aschorr@telemetry-investments.com> | 2019-01-14 09:56:14 -0500 |
commit | 99e184df5e808dd4de24b3e41c724bf9b00b9bb4 (patch) | |
tree | 4b40beb082fcbade974f46e7e151cc8cf2a7e604 | |
parent | 663aff4ae012468c54d2e994e839d0e75210ef80 (diff) | |
download | egawk-99e184df5e808dd4de24b3e41c724bf9b00b9bb4.tar.gz egawk-99e184df5e808dd4de24b3e41c724bf9b00b9bb4.tar.bz2 egawk-99e184df5e808dd4de24b3e41c724bf9b00b9bb4.zip |
Fix memory leak in new do_typeof optional array arg.
-rwxr-xr-x | ChangeLog | 5 | ||||
-rw-r--r-- | builtin.c | 6 |
2 files changed, 11 insertions, 0 deletions
@@ -1,3 +1,8 @@ +2019-01-14 Andrew J. Schorr <aschorr@telemetry-investments.com> + + * builtin.c (do_typeof): Fix memory leak when populating the + optional array, and make sure to call the astore method. + 2019-01-09 Andrew J. Schorr <aschorr@telemetry-investments.com> * awkgram.y (tokentab): Indicate that typeof may take 2 arguments. @@ -4090,6 +4090,9 @@ do_typeof(int nargs) NODE **lhs = assoc_lookup(dbg, sub); unref(*lhs); *lhs = make_string(arg->array_funcs->name, strlen(arg->array_funcs->name)); + if (dbg->astore != NULL) + (*dbg->astore)(dbg, sub); + unref(sub); } break; case Node_val: @@ -4125,6 +4128,9 @@ do_typeof(int nargs) NODE **lhs = assoc_lookup(dbg, sub); unref(*lhs); *lhs = make_string(s, strlen(s)); + if (dbg->astore != NULL) + (*dbg->astore)(dbg, sub); + unref(sub); } break; case Node_var_new: |