mmem: Prevent duplicate init of mmem

This could seriously corrupt data if mmem_init was called again after
someone called mmem_alloc.
ico
Daniel Willmann 2012-03-03 01:23:19 +01:00 committed by Wolf-Bastian Poettner
parent f13316415f
commit 60adaaad34
1 changed files with 5 additions and 0 deletions

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;
}
/*---------------------------------------------------------------------------*/