Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/hash Close file handle in error case. Found by cppc...
details: https://anonhg.NetBSD.org/src/rev/9a1a37b1068f
branches: trunk
changeset: 750882:9a1a37b1068f
user: wiz <wiz%NetBSD.org@localhost>
date: Sun Jan 17 23:10:20 2010 +0000
description:
Close file handle in error case. Found by cppcheck.
diffstat:
lib/libc/hash/hashhl.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diffs (21 lines):
diff -r f4c7608098c1 -r 9a1a37b1068f lib/libc/hash/hashhl.c
--- a/lib/libc/hash/hashhl.c Sun Jan 17 23:09:02 2010 +0000
+++ b/lib/libc/hash/hashhl.c Sun Jan 17 23:10:20 2010 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hashhl.c,v 1.3 2009/03/06 18:15:23 apb Exp $ */
+/* $NetBSD: hashhl.c,v 1.4 2010/01/17 23:10:20 wiz Exp $ */
/*
* ----------------------------------------------------------------------------
@@ -106,8 +106,10 @@
}
len = sb.st_size;
}
- if (off > 0 && lseek(fd, off, SEEK_SET) < 0)
+ if (off > 0 && lseek(fd, off, SEEK_SET) < 0) {
+ close(fd);
return (NULL);
+ }
while ((nr = read(fd, buffer, (size_t) MIN((off_t)sizeof(buffer), len)))
> 0) {
Home |
Main Index |
Thread Index |
Old Index