summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@cvs.openbsd.org>2010-09-26 22:15:40 +0000
committerDamien Miller <djm@cvs.openbsd.org>2010-09-26 22:15:40 +0000
commitb3a37071e2f5a49de4e7fd471b4ac4c1ce0f4111 (patch)
tree66ab5f5ad02e8361f7be0741f5f2b15b02eaf1b5
parentb22cc0b9b68583e753ae9313302534bfc3135d46 (diff)
oops, don't free array before freeing members; spotted by dkrause@
-rw-r--r--lib/libc/gen/glob.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/libc/gen/glob.c b/lib/libc/gen/glob.c
index dd72970fcaf..881b678bf39 100644
--- a/lib/libc/gen/glob.c
+++ b/lib/libc/gen/glob.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: glob.c,v 1.32 2010/09/24 13:32:55 djm Exp $ */
+/* $OpenBSD: glob.c,v 1.33 2010/09/26 22:15:39 djm Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@@ -865,11 +865,11 @@ globfree(glob_t *pglob)
pglob->gl_pathv = NULL;
}
if (pglob->gl_statv != NULL) {
- free(pglob->gl_statv);
for (i = 0; i < pglob->gl_pathc; i++) {
if (pglob->gl_statv[i] != NULL)
free(pglob->gl_statv[i]);
}
+ free(pglob->gl_statv);
pglob->gl_statv = NULL;
}
}