diff --git a/libraries/AP_Logger/AP_Logger.cpp b/libraries/AP_Logger/AP_Logger.cpp index 697db9dd00..7c5cf2e352 100644 --- a/libraries/AP_Logger/AP_Logger.cpp +++ b/libraries/AP_Logger/AP_Logger.cpp @@ -855,6 +855,8 @@ void AP_Logger::assert_same_fmt_for_name(const AP_Logger::log_write_fmt *f, AP_Logger::log_write_fmt *AP_Logger::msg_fmt_for_name(const char *name, const char *labels, const char *units, const char *mults, const char *fmt) { + WITH_SEMAPHORE(log_write_fmts_sem); + struct log_write_fmt *f; for (f = log_write_fmts; f; f=f->next) { if (f->name == name) { // ptr comparison diff --git a/libraries/AP_Logger/AP_Logger.h b/libraries/AP_Logger/AP_Logger.h index 6bc521e143..603097f0ac 100644 --- a/libraries/AP_Logger/AP_Logger.h +++ b/libraries/AP_Logger/AP_Logger.h @@ -413,6 +413,7 @@ private: const char *units; const char *mults; } *log_write_fmts; + HAL_Semaphore_Recursive log_write_fmts_sem; // return (possibly allocating) a log_write_fmt for a name struct log_write_fmt *msg_fmt_for_name(const char *name, const char *labels, const char *units, const char *mults, const char *fmt);