Skip to content

Commit 8286157

Browse files
zachdworkinj-xiong
authored andcommitted
[v1.20.x] prov/shm: Fix coverity issue about resource leak
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)
1 parent c10b680 commit 8286157

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

prov/shm/src/smr_ep.c

+3-1
Original file line numberDiff line numberDiff line change
@@ -1037,8 +1037,10 @@ static void *smr_start_listener(void *args)
10371037
ep->sock_info->peers[id].device_fds =
10381038
calloc(ep->sock_info->nfds,
10391039
sizeof(*ep->sock_info->peers[id].device_fds));
1040-
if (!ep->sock_info->peers[id].device_fds)
1040+
if (!ep->sock_info->peers[id].device_fds) {
1041+
close(sock);
10411042
goto out;
1043+
}
10421044
}
10431045
memcpy(ep->sock_info->peers[id].device_fds,
10441046
peer_fds, sizeof(*peer_fds) *

0 commit comments

Comments
 (0)