mirror of
git://git.gnu.org.ua/wordsplit.git
synced 2025-04-25 16:19:54 +03:00
Fix memory leaks
* wordsplit.c (wsnode_remove): Free the removed node. All uses changed.
This commit is contained in:
parent
f6e2d5bd4e
commit
cf2c7c86de
1 changed files with 2 additions and 7 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue