@@ -833,20 +833,8 @@ static void dplane_ctx_free_internal(struct zebra_dplane_ctx *ctx)
833
833
break ;
834
834
case DPLANE_OP_IPTABLE_ADD :
835
835
case DPLANE_OP_IPTABLE_DELETE :
836
- if (ctx -> u .iptable .interface_name_list ) {
837
- struct listnode * node , * nnode ;
838
- char * ifname ;
839
-
840
- for (ALL_LIST_ELEMENTS (
841
- ctx -> u .iptable .interface_name_list , node ,
842
- nnode , ifname )) {
843
- LISTNODE_DETACH (
844
- ctx -> u .iptable .interface_name_list ,
845
- node );
846
- XFREE (MTYPE_DP_NETFILTER , ifname );
847
- }
836
+ if (ctx -> u .iptable .interface_name_list )
848
837
list_delete (& ctx -> u .iptable .interface_name_list );
849
- }
850
838
break ;
851
839
case DPLANE_OP_GRE_SET :
852
840
case DPLANE_OP_INTF_NETCONFIG :
@@ -3476,6 +3464,11 @@ static int dplane_ctx_rule_init(struct zebra_dplane_ctx *ctx,
3476
3464
return AOK ;
3477
3465
}
3478
3466
3467
+ static void zebra_dplane_interface_name_list_deletion (void * data )
3468
+ {
3469
+ XFREE (MTYPE_DP_NETFILTER , data );
3470
+ }
3471
+
3479
3472
/**
3480
3473
* dplane_ctx_iptable_init() - Initialize a context block for a PBR iptable
3481
3474
* update.
@@ -3509,9 +3502,10 @@ static int dplane_ctx_iptable_init(struct zebra_dplane_ctx *ctx,
3509
3502
3510
3503
ctx -> zd_vrf_id = iptable -> vrf_id ;
3511
3504
memcpy (& ctx -> u .iptable , iptable , sizeof (struct zebra_pbr_iptable ));
3512
- ctx -> u .iptable .interface_name_list = NULL ;
3513
3505
if (iptable -> nb_interface > 0 ) {
3514
3506
ctx -> u .iptable .interface_name_list = list_new ();
3507
+ ctx -> u .iptable .interface_name_list -> del =
3508
+ zebra_dplane_interface_name_list_deletion ;
3515
3509
for (ALL_LIST_ELEMENTS_RO (iptable -> interface_name_list , node ,
3516
3510
ifname )) {
3517
3511
listnode_add (ctx -> u .iptable .interface_name_list ,
0 commit comments