From 992dde470bc70ff38d32269db55aabdb24f87766 Mon Sep 17 00:00:00 2001 From: Keith Bostic Date: Thu, 26 Sep 1991 22:27:32 -0800 Subject: [PATCH] check hashp before closing the file descriptor on error SCCS-vsn: lib/libc/db/hash/hash.c 5.19 --- usr/src/lib/libc/db/hash/hash.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/usr/src/lib/libc/db/hash/hash.c b/usr/src/lib/libc/db/hash/hash.c index fa6043e225..18201a4c60 100644 --- a/usr/src/lib/libc/db/hash/hash.c +++ b/usr/src/lib/libc/db/hash/hash.c @@ -9,7 +9,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char sccsid[] = "@(#)hash.c 5.18 (Berkeley) %G%"; +static char sccsid[] = "@(#)hash.c 5.19 (Berkeley) %G%"; #endif /* LIBC_SCCS and not lint */ #include @@ -199,7 +199,8 @@ __hash_open(file, flags, mode, info) return (dbp); error1: - (void)close(hashp->fp); + if (hashp != NULL) + (void)close(hashp->fp); error0: free(hashp); -- 2.20.1