summaryrefslogtreecommitdiff
path: root/src/search.cpp
diff options
context:
space:
mode:
authorAldrik Ramaekers <aldrikboy@gmail.com>2024-03-06 17:00:33 +0100
committerAldrik Ramaekers <aldrikboy@gmail.com>2024-03-06 17:00:33 +0100
commitd6ef32981a2402ec7b26c851ef13afd27a5582d8 (patch)
treedd46cdb68a9160b81bc7d958a307a9f7bfa8da77 /src/search.cpp
parent6a0f9d68555e0506a6aee42a5e25634196faf5a6 (diff)
free old results
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;
}