Skip to content
Snippets Groups Projects
Commit 06cb6208 authored by Danny Auble's avatar Danny Auble
Browse files

fix some memory issues

parent dee76f1d
No related branches found
No related tags found
No related merge requests found
......@@ -295,6 +295,9 @@ extern void clear_grid(void)
smap_node_t *smap_node;
int i;
if (!smap_system_ptr || !smap_system_ptr->grid)
return;
for (i = 0; i < smap_system_ptr->node_cnt; i++) {
smap_node = smap_system_ptr->grid[i];
smap_node->color = COLOR_WHITE;
......@@ -306,15 +309,17 @@ extern void free_grid(void)
{
int i;
if (smap_system_ptr == NULL)
if (!smap_system_ptr)
return;
for (i = 0; i < smap_system_ptr->node_cnt; i++) {
smap_node_t *smap_node = smap_system_ptr->grid[i];
xfree(smap_node->coord);
xfree(smap_node);
if (smap_system_ptr->grid) {
for (i = 0; i < smap_system_ptr->node_cnt; i++) {
smap_node_t *smap_node = smap_system_ptr->grid[i];
xfree(smap_node->coord);
xfree(smap_node);
}
xfree(smap_system_ptr->grid);
}
xfree(smap_system_ptr->grid);
xfree(smap_system_ptr);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment