summaryrefslogtreecommitdiff
path: root/src/search.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/search.cpp')
-rw-r--r--src/search.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/search.cpp b/src/search.cpp
index fe039bd..3f1f496 100644
--- a/src/search.cpp
+++ b/src/search.cpp
@@ -353,6 +353,13 @@ finish_early:;
return 0;
}
+void ts_destroy_result(ts_search_result* result) {
+ ts_memory_bucket_destroy(&result->memory);
+ ts_array_destroy(&result->files);
+ ts_array_destroy(&result->matches);
+ free(result);
+}
+
static void *_ts_list_files_thread(void *args)
{
ts_search_result *info = (ts_search_result *)args;
@@ -364,8 +371,7 @@ static void *_ts_list_files_thread(void *args)
while (!info->prev_result->search_completed) {
ts_thread_sleep(10);
}
- ts_memory_bucket_destroy(&info->prev_result->memory);
- free(info->prev_result);
+ ts_destroy_result(info->prev_result);
info->prev_result = nullptr;
}