diff options
Diffstat (limited to 'lib/libc/gen/getcwd.c')
-rw-r--r-- | lib/libc/gen/getcwd.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/libc/gen/getcwd.c b/lib/libc/gen/getcwd.c index 1ef4183f97d..19f811a2fc3 100644 --- a/lib/libc/gen/getcwd.c +++ b/lib/libc/gen/getcwd.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: getcwd.c,v 1.2 1996/08/19 08:23:15 tholo Exp $"; +static char rcsid[] = "$OpenBSD: getcwd.c,v 1.3 1996/11/27 22:00:45 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/param.h> @@ -55,7 +55,7 @@ getcwd(pt, size) size_t size; { register struct dirent *dp; - register DIR *dir; + register DIR *dir = NULL; register dev_t dev; register ino_t ino; register int first; @@ -226,5 +226,7 @@ err: if (ptsize) free(pt); free(up); + if (dir) + (void)closedir(dir); return (NULL); } |