diff options
author | Jeremy Allison <jra@samba.org> | 2007-09-08 05:12:17 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 12:30:35 -0500 |
commit | 923f14ff37cc1ea70631cb9037685246d941cfae (patch) | |
tree | 7dd472d6c9f4d11016328713f9880ed4376537e3 /source3 | |
parent | 5d49b172e0cb4142b30d003ce02583417ff417bd (diff) | |
download | samba-923f14ff37cc1ea70631cb9037685246d941cfae.tar.gz samba-923f14ff37cc1ea70631cb9037685246d941cfae.tar.bz2 samba-923f14ff37cc1ea70631cb9037685246d941cfae.zip |
r25021: Fix coverity #435. Use of -1.
Jeremy.
(This used to be commit f789186086b55a81c52e05d1f8c97c33b69131bd)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/nmbd/nmbd_subnetdb.c | 16 |
1 files changed, 12 insertions, 4 deletions
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); |