mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-03 15:18:54 +08:00
sdlog2: don't free the logbuffer after disarm
Only free the logbuffer if you exit sdlog2. After disarming, just reset the pointers. This way, we don't take any risks doing malloc and free. The actual "double free" was caused by trying to free the perf counter inside logbuffer_free.
This commit is contained in:
@@ -807,8 +807,8 @@ void sdlog2_stop_log()
|
||||
/* free log writer performance counter */
|
||||
perf_free(perf_write);
|
||||
|
||||
/* free log buffer */
|
||||
logbuffer_free(&lb);
|
||||
/* reset the logbuffer */
|
||||
logbuffer_reset(&lb);
|
||||
|
||||
mavlink_and_console_log_info(&mavlink_log_pub, "[blackbox] stopped (%lu drops)", skipped_count);
|
||||
|
||||
@@ -2136,7 +2136,8 @@ int sdlog2_thread_main(int argc, char *argv[])
|
||||
pthread_mutex_destroy(&logbuffer_mutex);
|
||||
pthread_cond_destroy(&logbuffer_cond);
|
||||
|
||||
free(lb.data);
|
||||
/* free log buffer */
|
||||
logbuffer_free(&lb);
|
||||
|
||||
thread_running = false;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user