correctly report failure to allocat log_buffer

This commit is contained in:
Mark Whitehorn
2016-04-29 06:54:58 -06:00
committed by Lorenz Meier
parent f07c93651f
commit 1b483bcc2a

View File

@@ -183,12 +183,24 @@ void Logger::run_trampoline(int argc, char *argv[])
return;
}
#ifdef DBGPRINT
struct mallinfo alloc_info = mallinfo();
warnx("largest free chunk: %d bytes", alloc_info.mxordblk);
warnx("allocating %d bytes for log_buffer", log_buffer_size);
#endif /* DBGPRINT */
logger_ptr = new Logger(log_buffer_size, log_interval, log_on_start);
if (logger_ptr == nullptr) {
PX4_WARN("alloc failed");
if (logger_ptr->_log_buffer == nullptr) {
PX4_WARN("log buffer malloc failed");
} else {
#ifdef DBGPRINT
alloc_info = mallinfo();
warnx("remaining free heap: %d bytes", alloc_info.fordblks);
#endif /* DBGPRINT */
logger_ptr->run();
}
}