summaryrefslogtreecommitdiffabout
authorSergey Poznyakoff <gray@gnu.org>2020-06-13 23:54:08 (GMT)
committer Sergey Poznyakoff <gray@gnu.org>2020-06-13 23:54:08 (GMT)
commitcf2c7c86debce18ab24c038afa6dde580c9706e0 (patch) (side-by-side diff)
tree75db3231aabca76878d0257fbcfbdb7db3dd0200
parentf6e2d5bd4ef0b83785d6a356418ef284ebc4b7c6 (diff)
downloadwordsplit-cf2c7c86debce18ab24c038afa6dde580c9706e0.tar.gz
wordsplit-cf2c7c86debce18ab24c038afa6dde580c9706e0.tar.bz2
Fix memory leaksHEADv1.1master
* wordsplit.c (wsnode_remove): Free the removed node. All uses changed.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--wordsplit.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/wordsplit.c b/wordsplit.c
index 99a8b4f..1950894 100644
--- a/wordsplit.c
+++ b/wordsplit.c
@@ -531,7 +531,7 @@ wsnode_remove (struct wordsplit *wsp, struct wordsplit_node *node)
else
wsp->ws_tail = node->prev;
- node->next = node->prev = NULL;
+ wsnode_free (node);
}
static struct wordsplit_node *
@@ -669,9 +669,8 @@ coalesce_segment (struct wordsplit *wsp, struct wordsplit_node *node)
if (p != node)
{
node->flags |= p->flags & _WSNF_QUOTE;
- wsnode_remove (wsp, p);
stop = p == end;
- wsnode_free (p);
+ wsnode_remove (wsp, p);
}
p = next;
}
@@ -1787,7 +1786,6 @@ node_expand (struct wordsplit *wsp, struct wordsplit_node *node,
if (tail != node)
{
wsnode_remove (wsp, node);
- wsnode_free (node);
}
return 0;
}
@@ -1806,7 +1804,6 @@ wsnode_nullelim (struct wordsplit *wsp)
if (p->flags & _WSNF_NULL)
{
wsnode_remove (wsp, p);
- wsnode_free (p);
}
p = next;
}
@@ -2132,7 +2129,6 @@ wordsplit_pathexpand (struct wordsplit *wsp)
if (wsp->ws_options & WRDSO_NULLGLOB)
{
wsnode_remove (wsp, p);
- wsnode_free (p);
}
else if (wsp->ws_options & WRDSO_FAILGLOB)
{
@@ -2174,7 +2170,6 @@ wordsplit_pathexpand (struct wordsplit *wsp)
globfree (&g);
wsnode_remove (wsp, p);
- wsnode_free (p);
}
}
free (pattern);

Return to:

Send suggestions and report system problems to the System administrator.