From 263e6e06bd023c0c3de6d48cc41448e7e7ffee4c Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Tue, 23 Mar 2021 11:58:58 +0100 Subject: [PATCH] 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 --- source3/nmbd/nmbd_subnetdb.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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; -- 2.47.3