Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vroute-netlink: pull missing leak fix from vroute #131

Merged
merged 1 commit into from
Jan 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions iked/vroute-netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,12 +328,13 @@ void
vroute_removeroute(struct iked *env, struct sockaddr *dest)
{
struct iked_vroute_sc *ivr = env->sc_vroute;
struct vroute_route *route;
struct vroute_route *route, *troute;

TAILQ_FOREACH(route, &ivr->ivr_routes, vr_entry) {
TAILQ_FOREACH_SAFE(route, &ivr->ivr_routes, vr_entry, troute) {
if (sockaddr_cmp(dest, (struct sockaddr *)&route->vr_dest, -1))
continue;
TAILQ_REMOVE(&ivr->ivr_routes, route, vr_entry);
free(route);
}
}

Expand Down Expand Up @@ -393,16 +394,17 @@ vroute_removeaddr(struct iked *env, int ifidx, struct sockaddr *addr,
struct sockaddr *mask)
{
struct iked_vroute_sc *ivr = env->sc_vroute;
struct vroute_addr *vaddr;
struct vroute_addr *vaddr, *tvaddr;

TAILQ_FOREACH(vaddr, &ivr->ivr_addrs, va_entry) {
TAILQ_FOREACH_SAFE(vaddr, &ivr->ivr_addrs, va_entry, tvaddr) {
if (sockaddr_cmp(addr, (struct sockaddr *)&vaddr->va_addr, -1))
continue;
if (sockaddr_cmp(mask, (struct sockaddr *)&vaddr->va_mask, -1))
continue;
if (ifidx != vaddr->va_ifidx)
continue;
TAILQ_REMOVE(&ivr->ivr_addrs, vaddr, va_entry);
free(vaddr);
}
}

Expand Down
Loading