diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-07-03 01:10:28 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-07-03 01:10:28 +0000 |
commit | d635eb923da3c1bfde7120c6b0c0fc8188766d39 (patch) | |
tree | ac2525898cd02bc5b5a861c38bcfe04fe4a2333a | |
parent | eb14320b843965f63578cfd5f231b6c092a80a12 (diff) |
do not free() before last ref; kmayer@freegate.com
-rw-r--r-- | lib/libc/gen/fts.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c index f221f986959..a2489d3f333 100644 --- a/lib/libc/gen/fts.c +++ b/lib/libc/gen/fts.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fts.c,v 1.15 1998/03/19 00:30:01 millert Exp $ */ +/* $OpenBSD: fts.c,v 1.16 1998/07/03 01:10:27 deraadt Exp $ */ /*- * Copyright (c) 1990, 1993, 1994 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)fts.c 8.6 (Berkeley) 8/14/94"; #else -static char rcsid[] = "$OpenBSD: fts.c,v 1.15 1998/03/19 00:30:01 millert Exp $"; +static char rcsid[] = "$OpenBSD: fts.c,v 1.16 1998/07/03 01:10:27 deraadt Exp $"; #endif #endif /* LIBC_SCCS and not lint */ @@ -245,14 +245,16 @@ fts_close(sp) (void)close(sp->fts_rfd); } - /* Free up the stream pointer. */ - free(sp); - /* Set errno and return. */ if (!ISSET(FTS_NOCHDIR) && saved_errno) { + /* Free up the stream pointer. */ + free(sp); errno = saved_errno; return (-1); } + + /* Free up the stream pointer. */ + free(sp); return (0); } |