fix memory leaks
This commit is contained in:
parent
df2129a1bb
commit
62f45f7256
@ -6,6 +6,7 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
|
|
||||||
// #include <config.h>
|
// #include <config.h>
|
||||||
|
#define HISTORY
|
||||||
|
|
||||||
#include "../FIFOBuff/FIFOBuffChar.h"
|
#include "../FIFOBuff/FIFOBuffChar.h"
|
||||||
#ifdef HISTORY
|
#ifdef HISTORY
|
||||||
|
|||||||
@ -17,7 +17,8 @@ CMDList_t* CMDList_init()
|
|||||||
// does not free up the commands
|
// does not free up the commands
|
||||||
int CMDList_deinit(CMDList_t *list)
|
int CMDList_deinit(CMDList_t *list)
|
||||||
{
|
{
|
||||||
CMDList_t** list_p = (CMDList_t**)list;
|
CMDList_t** list_p;
|
||||||
|
*list_p = list;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 26; i++)
|
for (i = 0; i < 26; i++)
|
||||||
@ -28,7 +29,7 @@ int CMDList_deinit(CMDList_t *list)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
free(*list_p);
|
free(list);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -22,7 +22,7 @@ typedef struct History_s {
|
|||||||
extern History_t* History_init();
|
extern History_t* History_init();
|
||||||
|
|
||||||
// destroy a fifo buffer (free up its space)
|
// 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
|
// put value i in buffer if there is still memory avaliable
|
||||||
extern int History_put(History_t *history, char* line);
|
extern int History_put(History_t *history, char* line);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user