Bug fix #20478: memp_malloc returns NULL+MEMP_SIZE rather than NULL on a failed allocation

This commit is contained in:
jgrubb 2007-07-14 00:07:43 +00:00
parent 116bcb9dfb
commit eb998bda62

View File

@ -278,6 +278,8 @@ memp_overflow_init(void)
/**
* Initialize this module.
*
* Carves out memp_memory into linked lists for each pool-type.
*/
void
memp_init(void)
@ -359,7 +361,8 @@ memp_malloc(memp_t type)
SYS_ARCH_UNPROTECT(old_level);
return (void*)((u8_t*)memp + MEMP_SIZE);
/* (bug fix #20478): dont return NULL+MEMP_SIZE! */
return (memp ? (void*)((u8_t*)memp + MEMP_SIZE) : NULL );
}
/**