From 57dfaec99bafb0eb45e634c605daf52bb1cd5d0d Mon Sep 17 00:00:00 2001
From: Quentin Armitage <quentin@armitage.org.uk>
Date: Thu, 30 Jun 2022 17:14:39 +0100
Subject: [PATCH] vrrp: deley freeing vrrp instances until all references are
 freed

Trackers etc have lists for vrrp instances that are tracking them.
Therefore the trackers, and their references, must be freed before the
vrrp instances are freed.

Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
Conflict: NA
Reference: https://github.com/acassen/keepalived/commit/57dfaec99bafb0eb45e634c605daf52bb1cd5d0d
---
 keepalived/vrrp/vrrp_data.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/keepalived/vrrp/vrrp_data.c b/keepalived/vrrp/vrrp_data.c
index b2c6f69..c144e64 100644
--- a/keepalived/vrrp/vrrp_data.c
+++ b/keepalived/vrrp/vrrp_data.c
@@ -1223,7 +1223,6 @@ free_vrrp_data(vrrp_data_t * data)
 	free_iproute_list(&data->static_routes);
 	free_iprule_list(&data->static_rules);
 	free_static_track_groups_list(&data->static_track_groups);
-	free_vrrp_list(&data->vrrp);
 	free_sync_group_list(&data->vrrp_sync_group);
 	free_vscript_list(&data->vrrp_script);
 	free_track_file_list(&data->vrrp_track_files);
@@ -1233,6 +1232,7 @@ free_vrrp_data(vrrp_data_t * data)
 #ifdef _WITH_BFD_
 	free_vrrp_tracked_bfd_list(&data->vrrp_track_bfds);
 #endif
+	free_vrrp_list(&data->vrrp);
 	FREE(data);
 }
 
-- 
2.23.0

