From ee551f4827cf861c84916726ceea0e3bb8afc46c Mon Sep 17 00:00:00 2001 From: Quentin Young Date: Tue, 13 Sep 2016 01:16:22 +0000 Subject: lib: Fix various matching bugs Missed a copy, disambigs forgot to walkback Signed-off-by: Quentin Young --- lib/command_match.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/command_match.c') diff --git a/lib/command_match.c b/lib/command_match.c index 68dda6f9cd..3faa059a44 100644 --- a/lib/command_match.c +++ b/lib/command_match.c @@ -208,7 +208,8 @@ command_match_r (struct graph_node *start, vector vline, unsigned int n) // that all nodes have the same data type, so when // deleting this list the last node must be // manually deleted - listnode_add (currbest, leaf->data); + struct cmd_element *el = leaf->data; + listnode_add (currbest, copy_cmd_element (el)); currbest->del = (void (*)(void *)) &del_cmd_token; break; } @@ -533,8 +534,10 @@ disambiguate (struct list *first, char *token = vector_slot(vline, i); if ((best = disambiguate_tokens (ftok, stok, token))) return best == ftok ? first : second; - ftok = listgetdata (listnextnode (fnode)); - stok = listgetdata (listnextnode (snode)); + fnode = listnextnode (fnode); + snode = listnextnode (snode); + ftok = listgetdata (fnode); + stok = listgetdata (snode); } return NULL; -- cgit v1.2.3