1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

memory: fix use after free

This commit is contained in:
Sonja Kolen 2018-07-09 12:54:18 +02:00
parent 43dc305fde
commit 6d613223cc
5 changed files with 3 additions and 8 deletions

View file

@ -135,10 +135,12 @@ int memory_free(void *ptr)
return ret;
/* Remove allocation entry */
ret = hash_table_delete(&allocations, ma->address);
ret = hash_table_delete(&allocations, ptr);
if (ret)
return ret;
free(ma);
return 0;
}

View file

@ -52,7 +52,6 @@ static struct memory_allocation * memory_heap_alloc(struct memory_type *m, size_
static int memory_heap_free(struct memory_type *m, struct memory_allocation *ma)
{
free(ma->address);
free(ma);
return 0;
}

View file

@ -87,8 +87,6 @@ static int memory_hugepage_free(struct memory_type *m, struct memory_allocation
if (ret)
return ret;
free(ma);
return 0;
}

View file

@ -76,8 +76,6 @@ static int memory_ib_free(struct memory_type *m, struct memory_allocation *ma)
if (ret)
return ret;
free(ma);
return 0;
}

View file

@ -152,8 +152,6 @@ static int memory_managed_free(struct memory_type *m, struct memory_allocation *
block->used = false;
}
free(ma);
return 0;
}