From a42895620d5b183969b946af0fb46729b05e99e4 Mon Sep 17 00:00:00 2001 From: Arthur Zakirov Date: Tue, 25 Dec 2018 14:29:47 +0300 Subject: [PATCH] Fix filling and releasing of black_list --- src/dir.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/dir.c b/src/dir.c index 3eeb96f3..37f41ddd 100644 --- a/src/dir.c +++ b/src/dir.c @@ -415,6 +415,7 @@ dir_list_file(parray *files, const char *root, bool exclude, bool omit_symlink, while (fgets(buf, lengthof(buf), black_list_file) != NULL) { + black_item[0] = '\0'; join_path_components(black_item, instance_config.pgdata, buf); if (black_item[strlen(black_item) - 1] == '\n') @@ -423,7 +424,7 @@ dir_list_file(parray *files, const char *root, bool exclude, bool omit_symlink, if (black_item[0] == '#' || black_item[0] == '\0') continue; - parray_append(black_list, black_item); + parray_append(black_list, pgut_strdup(black_item)); } fclose(black_list_file); @@ -446,6 +447,12 @@ dir_list_file(parray *files, const char *root, bool exclude, bool omit_symlink, if (!add_root) pgFileFree(file); + + if (black_list) + { + parray_walk(black_list, pfree); + parray_free(black_list); + } } #define CHECK_FALSE 0