diff options
Diffstat (limited to 'bftw.c')
-rw-r--r-- | bftw.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -511,7 +511,6 @@ static int dirqueue_push(struct dirqueue *queue, struct dircache_entry *entry) { /** Remove an entry from the dirqueue. */ static struct dircache_entry *dirqueue_pop(struct dirqueue *queue) { if (queue->front == queue->back) { - free(queue->entries); return NULL; } @@ -522,6 +521,11 @@ static struct dircache_entry *dirqueue_pop(struct dirqueue *queue) { return entry; } +/** Destroy a dirqueue. */ +static void dirqueue_free(struct dirqueue *queue) { + free(queue->entries); +} + /** Fill in ftwbuf fields with information from a struct dirent. */ static void ftwbuf_use_dirent(struct BFTW *ftwbuf, const struct dirent *de) { #if defined(_DIRENT_HAVE_D_TYPE) || defined(DT_DIR) @@ -909,6 +913,7 @@ static void bftw_state_free(struct bftw_state *state) { while (state->current) { bftw_pop(state, false); } + dirqueue_free(&state->queue); dircache_free(&state->cache); |