diff --git a/CLI/CLI.c b/CLI/CLI.c index 3daced7..0f09a60 100644 --- a/CLI/CLI.c +++ b/CLI/CLI.c @@ -68,7 +68,7 @@ bool CLI_deinit() FIFOBuffChar_delete(FIFO); #ifdef HISTORY - History_deinit(History); + History_deinit(History, true); #endif return true; } diff --git a/CMDList/CMDList.c b/CMDList/CMDList.c index d785fd3..d3233e5 100644 --- a/CMDList/CMDList.c +++ b/CMDList/CMDList.c @@ -44,7 +44,7 @@ int CMDList_add(CMDList_t *list, CMD_t* cmd, char* cmdName) read_p = cmd->cmd; } - while (returnCode == 0) + while (returnCode >= 0) { char c = *read_p & (~0x20); // convert to uppercase if ((c >= 'A') && (c <= 'Z')) diff --git a/History/History.c b/History/History.c index 74bdca0..10d60d9 100644 --- a/History/History.c +++ b/History/History.c @@ -19,7 +19,7 @@ History_t* History_init() } -int History_deinit(History_t* history) +int History_deinit(History_t* history, bool freeLines) { // Check if the buffer there is something in the buffer if (history->FirstEl_p == NULL) @@ -29,6 +29,10 @@ int History_deinit(History_t* history) while (el != NULL) { History_element_t* nextEl = el->nextEl_p; + if (freeLines) + { + free(el->line); + } free(el); el = nextEl; }