From: Andreas Schneider Date: Wed, 16 May 2018 09:59:09 +0000 (+0200) Subject: s3:winbind: Add sanity check when closing fd X-Git-Tag: ldb-1.4.0~137 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2a0ad57b211ad87709e5886f319a450c4f9db3fd;p=thirdparty%2Fsamba.git s3:winbind: Add sanity check when closing fd 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 9c2773d5d67..52b4c2c689f 100644 --- a/source3/winbindd/winbindd_cm.c +++ b/source3/winbindd/winbindd_cm.c @@ -1738,8 +1738,10 @@ static bool find_new_dc(TALLOC_CTX *mem_ctx, TALLOC_FREE(addrs); num_addrs = 0; - close(*fd); - *fd = -1; + if (*fd != -1) { + close(*fd); + *fd = -1; + } goto again; }