From 48ec9c64c67934e7f749006c5c37e5a9eed0e9e2 Mon Sep 17 00:00:00 2001 From: YuQing <384681@qq.com> Date: Sun, 4 Sep 2022 11:29:13 +0800 Subject: [PATCH] add func fc_free_iovec_array --- src/fast_task_queue.c | 1 + src/shared_func.h | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/src/fast_task_queue.c b/src/fast_task_queue.c index aed0e78..9baf905 100644 --- a/src/fast_task_queue.c +++ b/src/fast_task_queue.c @@ -463,6 +463,7 @@ static int _realloc_buffer(struct fast_task_info *pTask, const int new_size, const bool copy_data) { char *new_buff; + new_buff = (char *)fc_malloc(new_size); if (new_buff == NULL) { diff --git a/src/shared_func.h b/src/shared_func.h index bdf42ff..7756d52 100644 --- a/src/shared_func.h +++ b/src/shared_func.h @@ -1277,6 +1277,15 @@ static inline int fc_check_realloc_iovec_array( return 0; } +static inline void fc_free_iovec_array(iovec_array_t *array) +{ + if (array->iovs != NULL) { + free(array->iovs); + array->iovs = NULL; + array->alloc = 0; + } +} + static inline pid_t fc_gettid() { #ifdef OS_LINUX