Skip to content

Commit

Permalink
prov/shm: Fix coverity issue about resource leak
Browse files Browse the repository at this point in the history
Sock variable handle goes out of scope and leaks the handle.
This cleans it up properly.

Signed-off-by: Zach Dworkin <[email protected]>
  • Loading branch information
zachdworkin authored and j-xiong committed Jan 19, 2024
1 parent b069cb4 commit e6bc224
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion prov/shm/src/smr_ep.c
Original file line number Diff line number Diff line change
Expand Up @@ -1037,8 +1037,10 @@ static void *smr_start_listener(void *args)
ep->sock_info->peers[id].device_fds =
calloc(ep->sock_info->nfds,
sizeof(*ep->sock_info->peers[id].device_fds));
if (!ep->sock_info->peers[id].device_fds)
if (!ep->sock_info->peers[id].device_fds) {
close(sock);
goto out;
}
}
memcpy(ep->sock_info->peers[id].device_fds,
peer_fds, sizeof(*peer_fds) *
Expand Down

0 comments on commit e6bc224

Please sign in to comment.