SR MPLS path.frp_label_stack
provide one label stack per fib_table_entry_path_add2 call. otherwise multiple mheap releases take place.
@@ -75,6 +75,9 @@ create_sl (mpls_sr_policy_t * sr_policy, mpls_label_t * sl, u32 weight)
(weight != (u32) ~ 0 ? weight : SR_SEGMENT_LIST_WEIGHT_DEFAULT);
segment_list->segments = vec_dup (sl);
+ 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,
@@ -90,9 +93,6 @@ create_sl (mpls_sr_policy_t * sr_policy, mpls_label_t * sl, u32 weight)
fib_route_path_t *paths = NULL;
vec_add1 (paths, path);
- mpls_eos_bit_t eos;
- FOR_EACH_MPLS_EOS_BIT (eos)
- {
/* *INDENT-OFF* */
fib_prefix_t pfx = {
.fp_len = 21,
@@ -109,9 +109,8 @@ create_sl (mpls_sr_policy_t * sr_policy, mpls_label_t * sl, u32 weight)
(sr_policy->type == SR_POLICY_TYPE_DEFAULT ?
FIB_ENTRY_FLAG_NONE :
FIB_ENTRY_FLAG_MULTICAST), paths);
- }
-
vec_free (paths);
+ }
return segment_list;
}
