Skip to content

Commit

Permalink
[v1.19.x] 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]>
(cherry picked from commit e6bc224)
zachdworkin authored and j-xiong committed Jan 19, 2024
1 parent 7a86e24 commit 14db576
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
@@ -1018,8 +1018,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) *

0 comments on commit 14db576

Please sign in to comment.