Hello, t...@.

HASHFileChunk leaks file descriptor `fd'.

Index: lib/libc/hash/helper.c
===================================================================
RCS file: /OpenBSD/src/lib/libc/hash/helper.c,v
retrieving revision 1.8
diff -u -r1.8 helper.c
--- lib/libc/hash/helper.c      8 Aug 2005 08:05:35 -0000       1.8
+++ lib/libc/hash/helper.c      8 Jan 2010 11:49:26 -0000
@@ -62,8 +62,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, MIN(sizeof(buffer), len))) > 0) {
                HASHUpdate(&ctx, buffer, (size_t)nr);

Reply via email to