fix memory leaks

This commit is contained in:
Laila van Reenen 2024-04-14 22:47:18 +02:00
parent df2129a1bb
commit 62f45f7256
3 changed files with 5 additions and 3 deletions

View File

@ -6,6 +6,7 @@
#include <limits.h>
// #include <config.h>
#define HISTORY
#include "../FIFOBuff/FIFOBuffChar.h"
#ifdef HISTORY

View File

@ -17,7 +17,8 @@ CMDList_t* CMDList_init()
// does not free up the commands
int CMDList_deinit(CMDList_t *list)
{
CMDList_t** list_p = (CMDList_t**)list;
CMDList_t** list_p;
*list_p = list;
int i;
for (i = 0; i < 26; i++)
@ -28,7 +29,7 @@ int CMDList_deinit(CMDList_t *list)
}
}
free(*list_p);
free(list);
return 0;
}

View File

@ -22,7 +22,7 @@ typedef struct History_s {
extern History_t* History_init();
// destroy a fifo buffer (free up its space)
extern int History_deinit(History_t* history);
extern int History_deinit(History_t* history, bool freeLines);
// put value i in buffer if there is still memory avaliable
extern int History_put(History_t *history, char* line);