What steps will reproduce the problem?
1. code review
2.
3.
What is the expected output? What do you see instead?
What version of the product are you using? On what operating system?
Please provide any additional information below.
The second malloc should check mp->freemem is NULL pointer
--------------------------------------------------------------------------------
--------------
MemPool*
mempool_create()
{
MemPool *mp;
mp = (MemPool*)zz_malloc(sizeof(MemPool));
if (NULL == mp) {
DERROR("malloc MemPool error!\n");
return NULL;
}
memset(mp, 0, sizeof(MemPool));
mp->size = MEMLINK_MEM_NUM;
mp->freemem = (MemItem*)zz_malloc(sizeof(MemItem) * mp->size);
if (NULL == mp) { //---------should check mp->freemem is NULL pointer
DERROR("malloc MemItem error!\n");
zz_free(mp);
return NULL;
}
memset(mp->freemem, 0, sizeof(MemItem) * mp->size);
//g_mpool = mp;
return mp;
}
Original issue reported on code.google.com by NexusOne...@gmail.com on 12 Jul 2011 at 3:48
Original issue reported on code.google.com by
NexusOne...@gmail.com
on 12 Jul 2011 at 3:48