Skip to content

Commit

Permalink
bgpd: fix memory leak in rpki_create_socket
Browse files Browse the repository at this point in the history
Fix memory leak in rpki_create_socket. Coverity scanner issue 1575914.

Fixes: a951752 ("bgpd: create cache server socket in vrf")
Signed-off-by: Louis Scalbert <[email protected]>
  • Loading branch information
louis-6wind committed Jan 23, 2024
1 parent b28fd4e commit a1d4769
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion bgpd/bgp_rpki.c
Original file line number Diff line number Diff line change
Expand Up @@ -1343,8 +1343,10 @@ static int rpki_create_socket(void *_cache)
socket = vrf_socket(res->ai_family, res->ai_socktype,
res->ai_protocol, vrf->vrf_id, NULL);
}
if (socket < 0)
if (socket < 0) {
freeaddrinfo(res);
return -1;
}

pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, &cancel_state);
timeout.tv_sec = 30;
Expand Down

0 comments on commit a1d4769

Please sign in to comment.