fix memory leaks
This commit is contained in:
parent
df2129a1bb
commit
62f45f7256
@ -6,6 +6,7 @@
|
||||
#include <limits.h>
|
||||
|
||||
// #include <config.h>
|
||||
#define HISTORY
|
||||
|
||||
#include "../FIFOBuff/FIFOBuffChar.h"
|
||||
#ifdef HISTORY
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user