negative value passed to close on socket.c and resource leak
5457#if defined(SO_REUSEPORT) && defined(__linux__)
5458 int sock, yes = 1;
1. negative_return_fn: Function socket(2, SOCK_DGRAM, 0) returns a negative number.
2. var_assign: Assigning: signed variable sock = socket.
5459 sock = socket(AF_INET, SOCK_DGRAM, 0);
3. Condition sock < 0, taking true branch.
5460 if (sock < 0) {
CID 1441410 (#1 of 1): Argument cannot be negative (NEGATIVE_RETURNS)
4. negative_returns: sock is passed to a parameter that cannot be negative.
5461 close(sock);
5462 return;
also sock is not closed if setsockopt succeeds.
CID 1441415 (#1 of 1): Resource leak (RESOURCE_LEAK)
8. leaked_handle: Handle variable sock going out of scope leaks the handle.
5476}
Edited by Mark Andrews