From 923f14ff37cc1ea70631cb9037685246d941cfae Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Sat, 8 Sep 2007 05:12:17 +0000 Subject: r25021: Fix coverity #435. Use of -1. Jeremy. (This used to be commit f789186086b55a81c52e05d1f8c97c33b69131bd) --- source3/nmbd/nmbd_subnetdb.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'source3/nmbd') diff --git a/source3/nmbd/nmbd_subnetdb.c b/source3/nmbd/nmbd_subnetdb.c index a2b5a97a18..690ca5b621 100644 --- a/source3/nmbd/nmbd_subnetdb.c +++ b/source3/nmbd/nmbd_subnetdb.c @@ -124,8 +124,12 @@ static struct subnet_record *make_subnet(const char *name, enum subnet_type type subrec = SMB_MALLOC_P(struct subnet_record); if (!subrec) { DEBUG(0,("make_subnet: malloc fail !\n")); - close(nmb_sock); - close(dgram_sock); + if (nmb_sock != -1) { + close(nmb_sock); + } + if (dgram_sock != -1) { + close(dgram_sock); + } return(NULL); } @@ -133,8 +137,12 @@ static struct subnet_record *make_subnet(const char *name, enum subnet_type type if((subrec->subnet_name = SMB_STRDUP(name)) == NULL) { DEBUG(0,("make_subnet: malloc fail for subnet name !\n")); - close(nmb_sock); - close(dgram_sock); + if (nmb_sock != -1) { + close(nmb_sock); + } + if (dgram_sock != -1) { + close(dgram_sock); + } ZERO_STRUCTP(subrec); SAFE_FREE(subrec); return(NULL); -- cgit