ipa-proxy: Socket creation can fail, address coverity issue

Fixes: Coverity CID 1040722
This commit is contained in:
Holger Hans Peter Freyther 2013-12-12 16:16:35 +01:00
parent 7f180e83c3
commit e18209c975
1 changed files with 7 additions and 0 deletions

View File

@ -1005,6 +1005,13 @@ static struct ipa_proxy_conn *connect_bsc(struct sockaddr_in *sa, int priv_nr, v
bfd->data = ipc;
bfd->priv_nr = priv_nr;
if (bfd->fd < 0) {
LOGP(DLINP, LOGL_ERROR, "Could not create socket: %s\n",
strerror(errno));
talloc_free(ipc);
return NULL;
}
setsockopt(bfd->fd, SOL_SOCKET, SO_REUSEADDR, &on, sizeof(on));
ret = connect(bfd->fd, (struct sockaddr *) sa, sizeof(*sa));