Skip to content

Commit 9dabd1d

Browse files
committedOct 22, 2012
Close socket if bind() fails.
Coverity: CID 739685 (#1 of 1): Resource leak (RESOURCE_LEAK) At (8): Handle variable "sock" going out of scope leaks the handle. Signed-off-by: Henning Rogge <[email protected]>
1 parent c8e86b6 commit 9dabd1d

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed
 

‎src/linux/kernel_routes_nl.c

+1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ int rtnetlink_register_socket(int rtnl_mgrp)
101101

102102
if (bind(sock,(struct sockaddr *)&addr,sizeof(addr))<0) {
103103
OLSR_PRINTF(1,"could not bind rtnetlink socket! %s (%d)",strerror(errno), errno);
104+
close (sock);
104105
return -1;
105106
}
106107

0 commit comments

Comments
 (0)
Please sign in to comment.