MFIB: coverity fixes
[vpp.git] / src / vnet / mfib / mfib_entry.c
index 51d775d..79d2f9a 100644 (file)
@@ -633,16 +633,25 @@ mfib_entry_stack (mfib_entry_t *mfib_entry,
         {
             /*
              * for exclusive routes the source provided a replicate DPO
-             * we we stashed inthe special path list with one path
+             * which we stashed in the special path list with one path,
              * so we can stack directly on that.
              */
             ASSERT(1 == vec_len(ctx.next_hops));
 
-            dpo_stack(DPO_MFIB_ENTRY, dp,
-                      &mfib_entry->mfe_rep,
-                      &ctx.next_hops[0].path_dpo);
-            dpo_reset(&ctx.next_hops[0].path_dpo);
-            vec_free(ctx.next_hops);
+            if (NULL != ctx.next_hops)
+            {
+                dpo_stack(DPO_MFIB_ENTRY, dp,
+                          &mfib_entry->mfe_rep,
+                          &ctx.next_hops[0].path_dpo);
+                dpo_reset(&ctx.next_hops[0].path_dpo);
+                vec_free(ctx.next_hops);
+            }
+            else
+            {
+                dpo_stack(DPO_MFIB_ENTRY, dp,
+                          &mfib_entry->mfe_rep,
+                          drop_dpo_get(dp));
+            }
         }
     }
     else
@@ -1324,9 +1333,10 @@ mfib_entry_encode (fib_node_index_t mfib_entry_index,
 
     if (FIB_NODE_INDEX_INVALID != bsrc->mfes_pl)
     {
-        fib_path_list_walk(bsrc->mfes_pl,
-                           fib_path_encode,
-                           api_rpaths);
+        fib_path_list_walk_w_ext(bsrc->mfes_pl,
+                                 NULL,
+                                 fib_path_encode,
+                                 api_rpaths);
     }
 }