From 57cdf726b38c90c2b3fa72e217da5b18440ac010 Mon Sep 17 00:00:00 2001 From: Alex Duan <417921451@qq.com> Date: Mon, 17 Oct 2022 19:46:23 +0800 Subject: [PATCH] fix(shell): fixed tire tree free match error --- tools/shell/src/shellTire.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/tools/shell/src/shellTire.c b/tools/shell/src/shellTire.c index b310281119..346757b76f 100644 --- a/tools/shell/src/shellTire.c +++ b/tools/shell/src/shellTire.c @@ -275,7 +275,6 @@ void matchPrefixFromList(STire* tire, char* prefix, SMatch* match) { // match prefix words, if match is not NULL , put all item to match and return match void matchPrefixFromTree(STire* tire, char* prefix, SMatch* match) { - SMatch* root = match; int m = 0; STireNode* c = 0; int len = strlen(prefix); @@ -299,23 +298,14 @@ void matchPrefixFromTree(STire* tire, char* prefix, SMatch* match) { // previous items already matched if (i == len - 1) { - // malloc match if not pass by param match - if (root == NULL) { - root = (SMatch*)taosMemoryMalloc(sizeof(SMatch)); - memset(root, 0, sizeof(SMatch)); - strcpy(root->pre, prefix); - } - // prefix is match to end char - if (c->d) enumAllWords(c->d, prefix, root); + if (c->d) enumAllWords(c->d, prefix, match); } else { // move to next node continue match if (c->d == NULL) break; nodes = c->d; } } - - taosMemoryFree(root); } SMatch* matchPrefix(STire* tire, char* prefix, SMatch* match) {