Skip to content

Commit

Permalink
Free filerecs before exiting. This doesn't really make a difference in
Browse files Browse the repository at this point in the history
memory usage but helps us test the free functions on a more regular
basis.

Signed-off-by: Mark Fasheh <mfasheh@suse.de>
  • Loading branch information
Mark Fasheh committed Dec 10, 2014
1 parent 90c5b34 commit 62bc1c3
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions duperemove.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,7 @@ int main(int argc, char **argv)
else
print_dupes_table(&res);

free_all_filerecs();
out:
if (ret == ENOMEM || debug)
print_mem_stats();
Expand Down
10 changes: 10 additions & 0 deletions filerec.c
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,16 @@ void filerec_free(struct filerec *file)
}
}

void free_all_filerecs(void)
{
struct filerec *file, *tmp;

list_for_each_entry_safe(file, tmp, &filerec_list, rec_list) {
filerec_free(file);
}

}

int filerec_open(struct filerec *file, int write)
{
int ret = 0;
Expand Down
1 change: 1 addition & 0 deletions filerec.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ struct filerec {
};

void init_filerec(void);
void free_all_filerecs(void);

struct filerec *filerec_new(const char *filename, uint64_t inum,
uint64_t subvolid);
Expand Down

0 comments on commit 62bc1c3

Please sign in to comment.