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:
parent
f13316415f
commit
60adaaad34
|
@ -151,8 +151,13 @@ mmem_free(struct mmem *m)
|
||||||
void
|
void
|
||||||
mmem_init(void)
|
mmem_init(void)
|
||||||
{
|
{
|
||||||
|
static int inited = 0;
|
||||||
|
if(inited) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
list_init(mmemlist);
|
list_init(mmemlist);
|
||||||
avail_memory = MMEM_SIZE;
|
avail_memory = MMEM_SIZE;
|
||||||
|
inited = 1;
|
||||||
}
|
}
|
||||||
/*---------------------------------------------------------------------------*/
|
/*---------------------------------------------------------------------------*/
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue