From: Andreas Schneider Date: Wed, 16 May 2018 12:06:36 +0000 (+0200) Subject: s3:winbind: Check if we have an open file descriptor X-Git-Tag: ldb-1.4.0~136 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e1dad1d8ddeb9281b267186163dc4109cae3d599;p=thirdparty%2Fsamba.git s3:winbind: Check if we have an open file descriptor Found by Coverity. Signed-off-by: Andreas Schneider Reviewed-by: Guenther Deschner --- diff --git a/source3/winbindd/winbindd_cm.c b/source3/winbindd/winbindd_cm.c index 52b4c2c689f..95612034d2f 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -1983,7 +1983,10 @@ static NTSTATUS cm_open_connection(struct winbindd_domain *domain, &new_conn->cli, &retry); if (!NT_STATUS_IS_OK(result)) { /* Don't leak the smb connection socket */ - close(fd); + if (fd != -1) { + close(fd); + fd = -1; + } } if (!retry)