summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorotto <otto@openbsd.org>2007-01-08 09:13:38 +0000
committerotto <otto@openbsd.org>2007-01-08 09:13:38 +0000
commitf09e0181774222a0f032b2478801788de4412727 (patch)
tree014cbd40c61b45fce813e2a3c078c67910667e41
parentAdd support for Leadtek Winfast TV 2000 XP, from Tim Leslie (diff)
downloadwireguard-openbsd-f09e0181774222a0f032b2478801788de4412727.tar.xz
wireguard-openbsd-f09e0181774222a0f032b2478801788de4412727.zip
fix mem leak, from NetBSD; ok miod@ kettenis@
-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);