From: Volker Lendecke Date: Tue, 23 Mar 2021 10:58:58 +0000 (+0100) Subject: nmbd: Fix socket cleanup in make_subnet() X-Git-Tag: tevent-0.11.0~1385 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=263e6e06bd023c0c3de6d48cc41448e7e7ffee4c;p=thirdparty%2Fsamba.git nmbd: Fix socket cleanup in make_subnet() We can have -errno in the in those variables Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/nmbd/nmbd_subnetdb.c b/source3/nmbd/nmbd_subnetdb.c index aefe1d4be39..983369f0c6f 100644 --- a/source3/nmbd/nmbd_subnetdb.c +++ b/source3/nmbd/nmbd_subnetdb.c @@ -196,16 +196,16 @@ static struct subnet_record *make_subnet(const char *name, enum subnet_type type failed: SAFE_FREE(subrec); - if (nmb_sock != -1) { + if (nmb_sock >= 0) { close(nmb_sock); } - if (nmb_bcast != -1) { + if (nmb_bcast >= 0) { close(nmb_bcast); } - if (dgram_sock != -1) { + if (dgram_sock >= 0) { close(dgram_sock); } - if (dgram_bcast != -1) { + if (dgram_bcast >= 0) { close(dgram_bcast); } return NULL;