[INI] Fix memory leaks + other fixes (#38)
* [INI] Fix memory leaks + other fixes * Add ini_free * check and return if NULL pointer in free() * Add button check with timeout * Fix a bug in menu rendering that tries to parse a string without existing * Change initial cnt value to max (fixes menus with first entry not a selectable entry) * Some & ? clarifications * [INI] Add get selected boot cfg - This allows to free ini as we launch the firmware and have the lowest mem leak * [INI] Rename ini section clone/free functions
This commit is contained in:
@@ -97,6 +97,7 @@ static void _heap_free(heap_t *heap, u32 addr)
|
||||
while (node)
|
||||
{
|
||||
if (!node->used)
|
||||
{
|
||||
if (node->prev && !node->prev->used)
|
||||
{
|
||||
node->prev->size += node->size + sizeof(hnode_t);
|
||||
@@ -104,6 +105,7 @@ static void _heap_free(heap_t *heap, u32 addr)
|
||||
if (node->next)
|
||||
node->next->prev = node->prev;
|
||||
}
|
||||
}
|
||||
node = node->next;
|
||||
}
|
||||
}
|
||||
@@ -129,5 +131,6 @@ void *calloc(u32 num, u32 size)
|
||||
|
||||
void free(void *buf)
|
||||
{
|
||||
_heap_free(&_heap, (u32)buf);
|
||||
if (buf != NULL)
|
||||
_heap_free(&_heap, (u32)buf);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user