]> git.puffer.fish Git - matthieu/frr.git/commitdiff
lib: Fix various matching bugs
authorQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 13 Sep 2016 01:16:22 +0000 (01:16 +0000)
committerQuentin Young <qlyoung@cumulusnetworks.com>
Tue, 13 Sep 2016 01:16:22 +0000 (01:16 +0000)
Missed a copy, disambigs forgot to walkback

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
lib/command_match.c
lib/command_parse.y

index 68dda6f9cd639974a5e87e038653b782c78e8d8d..3faa059a440bd62778ffb66fe3b94ea92b9b613d 100644 (file)
@@ -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;
index a5d391d19e2072ac0f4df9f0066b6bbe11f87aba..bd958c5acefdc6c5f4646c7a3e83f880ba33dffe 100644 (file)
@@ -446,7 +446,7 @@ doc_next()
 {
   char *piece = NULL;
   if (!docstr || !(piece = strsep (&docstr, "\n")))
-    return NULL;
+    return XSTRDUP (MTYPE_CMD_TOKENS, "");
   return XSTRDUP (MTYPE_CMD_TOKENS, piece);
 }