VPP-1113 SR MPLS path.frp_label_stack

provide one label stack per fib_table_entry_path_add2 call. otherwise multiple mheap releases take place.

Change-Id: I475ca1b801fc85dddda0b540c69ad628a274df7f
Signed-off-by: Pablo Camarillo <pcamaril@cisco.com>
diff --git a/src/vnet/srmpls/sr_mpls_policy.c b/src/vnet/srmpls/sr_mpls_policy.c
index d75f2d1..1a5ba6c 100755
--- a/src/vnet/srmpls/sr_mpls_policy.c
+++ b/src/vnet/srmpls/sr_mpls_policy.c
@@ -75,24 +75,24 @@
     (weight != (u32) ~ 0 ? weight : SR_SEGMENT_LIST_WEIGHT_DEFAULT);
   segment_list->segments = vec_dup (sl);
 
-  fib_route_path_t path = {
-    .frp_proto = DPO_PROTO_MPLS,
-    .frp_sw_if_index = ~0,
-    .frp_fib_index = 0,
-    .frp_weight = segment_list->weight,
-    .frp_flags = FIB_ROUTE_PATH_FLAG_NONE,
-    .frp_label_stack = NULL,
-    .frp_local_label = sl[0],
-  };
-
-  vec_add (path.frp_label_stack, sl + 1, vec_len (sl) - 1);
-
-  fib_route_path_t *paths = NULL;
-  vec_add1 (paths, path);
-
   mpls_eos_bit_t eos;
   FOR_EACH_MPLS_EOS_BIT (eos)
   {
+    fib_route_path_t path = {
+      .frp_proto = DPO_PROTO_MPLS,
+      .frp_sw_if_index = ~0,
+      .frp_fib_index = 0,
+      .frp_weight = segment_list->weight,
+      .frp_flags = FIB_ROUTE_PATH_FLAG_NONE,
+      .frp_label_stack = NULL,
+      .frp_local_label = sl[0],
+    };
+
+    vec_add (path.frp_label_stack, sl + 1, vec_len (sl) - 1);
+
+    fib_route_path_t *paths = NULL;
+    vec_add1 (paths, path);
+
 		/* *INDENT-OFF* */
 		fib_prefix_t	pfx = {
 			.fp_len = 21,
@@ -109,10 +109,9 @@
 			       (sr_policy->type == SR_POLICY_TYPE_DEFAULT ?
 				FIB_ENTRY_FLAG_NONE :
 				FIB_ENTRY_FLAG_MULTICAST), paths);
+    vec_free (paths);
   }
 
-  vec_free (paths);
-
   return segment_list;
 }