Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Close dtls_fd on error returns from connect_dtls_socket()
Spotted by Coverity.

Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
  • Loading branch information
David Woodhouse authored and David Woodhouse committed Sep 26, 2012
1 parent 87d3f31 commit 7faa25d
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dtls.c
Expand Up @@ -544,11 +544,13 @@ int connect_dtls_socket(struct openconnect_info *vpninfo)
_("Unknown protocol family %d. Cannot do DTLS\n"),
vpninfo->peer_addr->sa_family);
vpninfo->dtls_attempt_period = 0;
close(dtls_fd);
return -EINVAL;
}

if (bind(dtls_fd, (struct sockaddr *)&dtls_bind_addr, dtls_bind_addrlen)) {
perror(_("Bind UDP socket for DTLS"));
close(dtls_fd);
return -EINVAL;
}
}
Expand Down

0 comments on commit 7faa25d

Please sign in to comment.