Implicit out of memory check in Release Mode

This commit is contained in:
vemax78
2013-08-11 22:50:12 +02:00
parent 7ddb32d217
commit badad6e71d
3 changed files with 8 additions and 6 deletions

View File

@ -37,15 +37,15 @@ void* capwap_alloc_debug(size_t size, const char* file, const int line) {
if (size <= 0) {
capwap_logging_debug("%s(%d): Invalid memory size %d", file, line, size);
DEBUG_BREAKPOINT();
return NULL;
capwap_exit(CAPWAP_ASSERT_CONDITION);
}
/* Alloc block with memory block and canary */
block = (struct capwap_memory_block*)malloc(sizeof(struct capwap_memory_block) + size + 4);
if (!block) {
capwap_logging_debug("Out of memory %s(%d)", __FILE__, __LINE__);
capwap_logging_debug("Out of memory %s(%d)", file, line);
DEBUG_BREAKPOINT();
return NULL;
capwap_exit(CAPWAP_OUT_OF_MEMORY);
}
/* Info memory block */