switch to freeRtos malloc + improve malloc_safe utils, fixed memleak

This commit is contained in:
2018-01-14 00:04:53 +01:00
parent 0ef1134aa0
commit ace2bd6357
21 changed files with 152 additions and 140 deletions
+3 -5
View File
@@ -96,9 +96,8 @@ static void DO_writeIni(Unit *unit, IniWriter *iw)
/** Allocate data structure and set defaults */
static error_t DO_preInit(Unit *unit)
{
bool suc = true;
struct priv *priv = unit->data = calloc_ck(1, sizeof(struct priv), &suc);
if (!suc) return E_OUT_OF_MEM;
struct priv *priv = unit->data = calloc_ck(1, sizeof(struct priv));
if (priv == NULL) return E_OUT_OF_MEM;
// some defaults
priv->port_name = 'A';
@@ -153,8 +152,7 @@ static void DO_deInit(Unit *unit)
rsc_teardown(unit);
// Free memory
free(unit->data);
unit->data = NULL;
free_ck(unit->data);
}
// ------------------------------------------------------------------------