summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlic121 <lic121@chinatelecom.cn>2022-05-26 14:25:13 +0000
committerIlya Maximets <i.maximets@ovn.org>2022-06-28 12:08:55 +0200
commit94fd5f560039cf40aca1600591663e30e602142f (patch)
tree22f4341a4c268415c1cc8bf547cb5c397a56d110
parent1f2253ff2ad1a051ab7150d19aadbd57ba041217 (diff)
downloadopenvswitch-94fd5f560039cf40aca1600591663e30e602142f.tar.gz
lldp: Fix lldp memory leak.
lldp_create() malloc memory for lldp->lldpd->g_hardware. lldp_unref is supposed to free the memory regardless of hw->h_flags. Signed-off-by: lic121 <lic121@chinatelecom.cn> Acked-by: Eelco Chaudron <echaudro@redhat.com> Acked-by: Paolo Valerio <pvalerio@redhat.com> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
-rw-r--r--lib/lldp/lldpd.c10
1 files changed, 3 insertions, 7 deletions
diff --git a/lib/lldp/lldpd.c b/lib/lldp/lldpd.c
index 34738535d..c377204b3 100644
--- a/lib/lldp/lldpd.c
+++ b/lib/lldp/lldpd.c
@@ -140,13 +140,9 @@ lldpd_cleanup(struct lldpd *cfg)
VLOG_DBG("cleanup all ports");
LIST_FOR_EACH_SAFE (hw, hw_next, h_entries, &cfg->g_hardware) {
- if (!hw->h_flags) {
- ovs_list_remove(&hw->h_entries);
- lldpd_remote_cleanup(hw, NULL, true);
- lldpd_hardware_cleanup(cfg, hw);
- } else {
- lldpd_remote_cleanup(hw, NULL, false);
- }
+ ovs_list_remove(&hw->h_entries);
+ lldpd_remote_cleanup(hw, NULL, true);
+ lldpd_hardware_cleanup(cfg, hw);
}
VLOG_DBG("cleanup all chassis");