summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
Diffstat (limited to 'libc')
-rw-r--r--libc/misc/glob/glob.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libc/misc/glob/glob.c b/libc/misc/glob/glob.c
index f45a2c487..8078dee38 100644
--- a/libc/misc/glob/glob.c
+++ b/libc/misc/glob/glob.c
@@ -260,8 +260,8 @@ globfree (pglob)
{
if (pglob->gl_pathv != NULL)
{
- register int i;
- for (i = 0; i < pglob->gl_pathc; ++i)
+ register int i = pglob->gl_flags & GLOB_DOOFFS? pglob->gl_offs : 0;
+ for (; i < pglob->gl_pathc; ++i)
if (pglob->gl_pathv[i] != NULL)
free ((__ptr_t) pglob->gl_pathv[i]);
free ((__ptr_t) pglob->gl_pathv);