mirror of
https://github.com/openvswitch/ovs
synced 2025-08-23 02:17:42 +00:00
lldp: Fix Coverity warning about resource leak in lldp test.
Coverity reported a potential resource leak in the LLDP test code. While this condition should never occur in practice, since the test would crash on out-of-memory, the warning is addressed by ensuring the cleanup function is called on error paths. Acked-by: Aaron Conole <aconole@redhat.com> Signed-off-by: Eelco Chaudron <echaudro@redhat.com>
This commit is contained in:
parent
d283829477
commit
8fca3f99cf
@ -971,6 +971,7 @@ lldp_destroy_dummy(struct lldp *lldp)
|
|||||||
|
|
||||||
cfg = lldp->lldpd;
|
cfg = lldp->lldpd;
|
||||||
|
|
||||||
|
if (cfg) {
|
||||||
LIST_FOR_EACH_SAFE (hw, h_entries, &cfg->g_hardware) {
|
LIST_FOR_EACH_SAFE (hw, h_entries, &cfg->g_hardware) {
|
||||||
ovs_list_remove(&hw->h_entries);
|
ovs_list_remove(&hw->h_entries);
|
||||||
free(hw->h_lport.p_lastframe);
|
free(hw->h_lport.p_lastframe);
|
||||||
@ -983,6 +984,8 @@ lldp_destroy_dummy(struct lldp *lldp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
free(lldp->lldpd);
|
free(lldp->lldpd);
|
||||||
|
}
|
||||||
|
|
||||||
free(lldp);
|
free(lldp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,6 +183,7 @@ test_aa_send(void)
|
|||||||
(lldp->lldpd == NULL) ||
|
(lldp->lldpd == NULL) ||
|
||||||
ovs_list_is_empty(&lldp->lldpd->g_hardware)) {
|
ovs_list_is_empty(&lldp->lldpd->g_hardware)) {
|
||||||
printf("Error: unable to create dummy lldp instance");
|
printf("Error: unable to create dummy lldp instance");
|
||||||
|
lldp_destroy_dummy(lldp);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user