Skip to content

Commit

Permalink
[v1.20.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 <zachary.dworkin@intel.com>
(cherry picked from commit e6bc224)
  • Loading branch information
zachdworkin authored and j-xiong committed Jan 20, 2024
1 parent c10b680 commit 8286157
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 8286157

Please sign in to comment.