Skip to content

Commit

Permalink
[v1.18.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 19, 2024
1 parent 2c9b291 commit 9fe8d81
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 @@ -1190,8 +1190,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 9fe8d81

Please sign in to comment.