gawk-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[SCM] gawk branch, feature/memory-work, updated. gawk-4.1.0-4947-g404350


From: Arnold Robbins
Subject: [SCM] gawk branch, feature/memory-work, updated. gawk-4.1.0-4947-g404350f
Date: Wed, 31 Mar 2021 14:57:59 -0400 (EDT)

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "gawk".

The branch, feature/memory-work has been updated
       via  404350f1d91bbabc610afaf80d455eb8b2aaaadf (commit)
      from  76d5b6034e667f552b1f19babb657f4c8fa2e891 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.sv.gnu.org/cgit/gawk.git/commit/?id=404350f1d91bbabc610afaf80d455eb8b2aaaadf

commit 404350f1d91bbabc610afaf80d455eb8b2aaaadf
Author: Arnold D. Robbins <arnold@skeeve.com>
Date:   Wed Mar 31 21:57:44 2021 +0300

    Fix more memory leaks.

diff --git a/str_array.c b/str_array.c
index f54e0f2..40ad698 100644
--- a/str_array.c
+++ b/str_array.c
@@ -215,7 +215,7 @@ str_lookup(NODE *symbol, NODE *subs)
        symbol->buckets[hash1] = b;
        b->ahname_str = estrdup(subs->stptr, subs->stlen);
        b->ahname_len = subs->stlen;
-       DEREF(subs);
+       unref(subs);
        b->ahvalue = dupnode(Nnull_string);
        b->ahcode = code1;
        return & (b->ahvalue);
@@ -537,7 +537,7 @@ str_dump(NODE *symbol, NODE *ndump)
 
                                tmp = make_string(b->ahname_str, b->ahname_len);
                                assoc_info(tmp, b->ahvalue, ndump, aname);
-                               DEREF(tmp);
+                               unref(tmp);
                        }
                }
        }
diff --git a/symbol.c b/symbol.c
index c209375..1b06ff7 100644
--- a/symbol.c
+++ b/symbol.c
@@ -412,6 +412,7 @@ get_symbols(SYMBOL_TYPE what, bool sort)
                emalloc(table, NODE **, (func_count + 1) * sizeof(NODE *), 
"get_symbols");
 
                for (i = count = 0; i < max; i += 2) {
+                       unref(list[i]); // the index string
                        r = list[i+1];
                        if (r->type == Node_ext_func || r->type == 
Node_builtin_func)
                                continue;
@@ -429,6 +430,7 @@ get_symbols(SYMBOL_TYPE what, bool sort)
                emalloc(table, NODE **, (var_count + 1 + 1 + 1) * sizeof(NODE 
*), "get_symbols");
 
                for (i = count = 0; i < max; i += 2) {
+                       unref(list[i]); // the index string
                        r = list[i+1];
                        if (r->type == Node_val)        /* non-variable in 
SYMTAB */
                                continue;
@@ -602,6 +604,7 @@ load_symbols()
                if (max == 0)
                        continue;
                for (j = 0; j < max; j += 2) {
+                       unref(list[j]); // the index string
                        r = list[j+1];
                        if (   r->type == Node_ext_func
                            || r->type == Node_func
@@ -637,7 +640,6 @@ load_symbols()
                                        break;
                                }
                        }
-                       unref(list[j]); // the index string
                }
                efree(list);
        }
@@ -688,8 +690,10 @@ check_param_names(void)
 
        for (i = 0; i < max; i += 2) {
                f = list[i+1];
-               if (f->type == Node_builtin_func || f->param_cnt == 0)
+               if (f->type == Node_builtin_func || f->param_cnt == 0) {
+                       unref(list[i]); // free the index string
                        continue;
+               }
 
                /* loop over each param in function i */
                for (j = 0; j < f->param_cnt; j++) {
@@ -707,6 +711,7 @@ check_param_names(void)
                                result = false;
                        }
                }
+               unref(list[i]); // free the index string
        }
 
        efree(list);

-----------------------------------------------------------------------

Summary of changes:
 str_array.c | 4 ++--
 symbol.c    | 9 +++++++--
 2 files changed, 9 insertions(+), 4 deletions(-)


hooks/post-receive
-- 
gawk



reply via email to

[Prev in Thread] Current Thread [Next in Thread]