3c09e9d sss_ssh_knownhostsproxy: fixed Coverity issue

1 file Authored by atikhonov 9 months ago , Committed by pbrezina 9 months ago ,
    sss_ssh_knownhostsproxy: fixed Coverity issue
    Actually I think this Coverity error was "false positive":
    Error: RESOURCE_LEAK (CWE-772):
    sssd-2.2.3/src/sss_client/ssh/sss_ssh_knownhostsproxy.c:67: open_fn: Returning handle opened by "socket".
    sssd-2.2.3/src/sss_client/ssh/sss_ssh_knownhostsproxy.c:67: var_assign: Assigning: "sock" = handle returned from "socket(family, SOCK_STREAM, IPPROTO_TCP)".
    sssd-2.2.3/src/sss_client/ssh/sss_ssh_knownhostsproxy.c:76: noescape: Resource "sock" is not freed or pointed-to in "connect".
    sssd-2.2.3/src/sss_client/ssh/sss_ssh_knownhostsproxy.c:88: leaked_handle: Handle variable "sock" going out of scope leaks the handle.
       86|   done:
       87|       if (ret != 0 && sock >= 0) close(sock);
       88|->     return ret;
       89|   }
    Nonetheless it is easier to adjust the code to avoid a complaint.
    Reviewed-by: Michal Židek <mzidek@redhat.com>