aboutsummaryrefslogtreecommitdiffstats
path: root/node.c
diff options
context:
space:
mode:
Diffstat (limited to 'node.c')
-rw-r--r--node.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/node.c b/node.c
index 5fe8a6f5..24d2ca22 100644
--- a/node.c
+++ b/node.c
@@ -278,6 +278,11 @@ dupnode(NODE *n)
{
NODE *r;
+ if (n->type == Node_ahash) {
+ n->ahname_ref++;
+ return n;
+ }
+
assert(n->type == Node_val);
if ((n->flags & PERM) != 0)
@@ -452,6 +457,16 @@ unref(NODE *tmp)
if ((tmp->flags & PERM) != 0)
return;
+ if (tmp->type == Node_ahash) {
+ if (tmp->ahname_ref > 1)
+ tmp->ahname_ref--;
+ else {
+ efree(tmp->ahname_str);
+ freenode(tmp);
+ }
+ return;
+ }
+
if ((tmp->flags & MALLOC) != 0) {
if (tmp->valref > 1) {
tmp->valref--;