mmem: Prevent duplicate init of mmem

This could seriously corrupt data if mmem_init was called again after
someone called mmem_alloc.
This commit is contained in:
Daniel Willmann 2012-03-03 01:23:19 +01:00 committed by Wolf-Bastian Poettner
parent f13316415f
commit 60adaaad34

View File

@ -151,8 +151,13 @@ mmem_free(struct mmem *m)
void
mmem_init(void)
{
static int inited = 0;
if(inited) {
return;
}
list_init(mmemlist);
avail_memory = MMEM_SIZE;
inited = 1;
}
/*---------------------------------------------------------------------------*/