summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>2001-03-19 13:45:31 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>2001-03-19 13:45:31 +0000
commit44c39f2da9d4b48e6352928a840a495de903f629 (patch)
tree4ef8eb8c44610cea0e0aea0ca1af8cf89cb94487 /lib
parentdca8f0ac8659232f5204559af8536727104e3fb7 (diff)
set gl_pathv to NULL after we free it; christos@netbsd.org
Diffstat (limited to 'lib')
-rw-r--r--lib/libc/gen/glob.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libc/gen/glob.c b/lib/libc/gen/glob.c
index f4e1fe610f5..7f5ff1a0687 100644
--- a/lib/libc/gen/glob.c
+++ b/lib/libc/gen/glob.c
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)glob.c 8.3 (Berkeley) 10/13/93";
#else
-static char rcsid[] = "$OpenBSD: glob.c,v 1.9 2001/03/18 17:18:58 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: glob.c,v 1.10 2001/03/19 13:45:30 millert Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
@@ -666,8 +666,10 @@ globextend(path, pglob, limitp)
pathv = pglob->gl_pathv ? realloc((char *)pglob->gl_pathv, newsize) :
malloc(newsize);
if (pathv == NULL) {
- if (pglob->gl_pathv)
+ if (pglob->gl_pathv) {
free(pglob->gl_pathv);
+ pglob->gl_pathv = NULL;
+ }
return(GLOB_NOSPACE);
}
@@ -764,6 +766,7 @@ globfree(pglob)
if (*pp)
free(*pp);
free(pglob->gl_pathv);
+ pglob->gl_pathv = NULL;
}
}