summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dir.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/dir.c b/dir.c
index d81ae28ee9..9f2d36b633 100644
--- a/dir.c
+++ b/dir.c
@@ -2803,8 +2803,10 @@ glob_opendir(ruby_glob_entries_t *ent, DIR *dirp, int flags, rb_encoding *enc)
}
if (count >= capacity) {
capacity += 256;
- if (!(newp = GLOB_REALLOC_N(ent->sort.entries, capacity)))
+ if (!(newp = GLOB_REALLOC_N(ent->sort.entries, capacity))) {
+ GLOB_FREE(rdp);
goto nomem;
+ }
ent->sort.entries = newp;
}
ent->sort.entries[count++] = rdp;