From 241895515a031f88ca4b3973ac71616b4522fa49 Mon Sep 17 00:00:00 2001 From: Leah Neukirchen Date: Mon, 13 Nov 2017 16:54:51 +0100 Subject: callback: free unregistered fileinfo immediately --- lr.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'lr.c') diff --git a/lr.c b/lr.c index acb2526..7d75f3f 100644 --- a/lr.c +++ b/lr.c @@ -2033,13 +2033,15 @@ callback(const char *fpath, const struct stat *sb, int depth, ino_t entries, off if (Uflag) { print_format(fi); free_fi(fi); + return 0; } else if (Bflag) { - if (initial) { - if (fi->depth == 0) - root = fitree_insert(root, fi); + if (initial && fi->depth == 0) { + root = fitree_insert(root, fi); + } else if (!initial && fi->depth == bflag_depth + 1) { + new_root = fitree_insert(new_root, fi); } else { - if (fi->depth == bflag_depth + 1) - new_root = fitree_insert(new_root, fi); + free_fi(fi); + return 0; } } else { // add to the tree, note that this will eliminate duplicate files -- cgit 1.4.1