diff --git a/source/libs/stream/src/streamTask.c b/source/libs/stream/src/streamTask.c index fc72489ee6..1cbbcac046 100644 --- a/source/libs/stream/src/streamTask.c +++ b/source/libs/stream/src/streamTask.c @@ -318,19 +318,18 @@ void streamFreeTaskState(SStreamTask* pTask, int8_t remove) { taskDbRemoveRef(pTask->pBackend); pTask->pBackend = NULL; pTask->pState = NULL; - if (pTask->backendPath != NULL) { - taosMemoryFree(pTask->backendPath); - pTask->backendPath = NULL; - } } else { if (remove) { if (pTask->backendPath != NULL) { taosRemoveDir(pTask->backendPath); - taosMemoryFree(pTask->backendPath); - pTask->backendPath = NULL; } } } + + if (pTask->backendPath != NULL) { + taosMemoryFree(pTask->backendPath); + pTask->backendPath = NULL; + } } static void setInitialVersionInfo(SStreamTask* pTask, int64_t ver) {