summaryrefslogtreecommitdiff
path: root/lib/libc
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2007-01-08 09:13:39 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2007-01-08 09:13:39 +0000
commit57f30f1e02f248dca0c929ad89b5ee540b182aeb (patch)
tree8ab1f706b7f3959020b41f2e94dc5ba891362e37 /lib/libc
parent68457c88ff35e4639e2a66967dbacafd74290ac7 (diff)
fix mem leak, from NetBSD; ok miod@ kettenis@
Diffstat (limited to 'lib/libc')
-rw-r--r--lib/libc/gen/fts.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c
index 5b8b60957db..785645bf01b 100644
--- a/lib/libc/gen/fts.c
+++ b/lib/libc/gen/fts.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fts.c,v 1.37 2005/08/08 08:05:34 espie Exp $ */
+/* $OpenBSD: fts.c,v 1.38 2007/01/08 09:13:38 otto Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -162,6 +162,9 @@ fts_open(char * const *argv, int options,
if (!ISSET(FTS_NOCHDIR) && (sp->fts_rfd = open(".", O_RDONLY, 0)) < 0)
SET(FTS_NOCHDIR);
+ if (nitems == 0)
+ free(parent);
+
return (sp);
mem3: fts_lfree(root);