diff --git a/libraries/DataFlash/DataFlash_File.cpp b/libraries/DataFlash/DataFlash_File.cpp index 73aa8dff2a..4316710c71 100644 --- a/libraries/DataFlash/DataFlash_File.cpp +++ b/libraries/DataFlash/DataFlash_File.cpp @@ -149,7 +149,9 @@ bool DataFlash_File::NeedErase(void) char *DataFlash_File::_log_file_name(uint16_t log_num) { char *buf = NULL; - asprintf(&buf, "%s/%u.BIN", _log_directory, (unsigned)log_num); + if (asprintf(&buf, "%s/%u.BIN", _log_directory, (unsigned)log_num) == 0) { + return NULL; + } return buf; } @@ -160,7 +162,9 @@ char *DataFlash_File::_log_file_name(uint16_t log_num) char *DataFlash_File::_lastlog_file_name(void) { char *buf = NULL; - asprintf(&buf, "%s/LASTLOG.TXT", _log_directory); + if (asprintf(&buf, "%s/LASTLOG.TXT", _log_directory) == 0) { + return NULL; + } return buf; } diff --git a/libraries/DataFlash/DataFlash_SITL.cpp b/libraries/DataFlash/DataFlash_SITL.cpp index 219d30216b..847af6e5d0 100644 --- a/libraries/DataFlash/DataFlash_SITL.cpp +++ b/libraries/DataFlash/DataFlash_SITL.cpp @@ -16,6 +16,8 @@ #include #include "DataFlash.h" +#pragma GCC diagnostic ignored "-Wunused-result" + #define DF_PAGE_SIZE 512 #define DF_NUM_PAGES 16384