summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2001-03-19 13:45:30 +0000
committermillert <millert@openbsd.org>2001-03-19 13:45:30 +0000
commit1747cd00a0228c73e190945060fe5074ba2e8ded (patch)
tree82556dd9932022f2b2d596ea278e8bd376cda872
parentdocument PreferredAuthentications options; ok markus@ (diff)
downloadwireguard-openbsd-1747cd00a0228c73e190945060fe5074ba2e8ded.tar.xz
wireguard-openbsd-1747cd00a0228c73e190945060fe5074ba2e8ded.zip
set gl_pathv to NULL after we free it; christos@netbsd.org
-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;
}
}