mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-16 23:43:33 +08:00
sdlog2: Free log buffer on log stop
This commit is contained in:
@@ -143,3 +143,10 @@ void logbuffer_mark_read(struct logbuffer_s *lb, int n)
|
||||
{
|
||||
lb->read_ptr = (lb->read_ptr + n) % lb->size;
|
||||
}
|
||||
|
||||
void logbuffer_free(struct logbuffer_s *lb)
|
||||
{
|
||||
if (lb->data) {
|
||||
free(lb->data);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,4 +65,6 @@ int logbuffer_get_ptr(struct logbuffer_s *lb, void **ptr, bool *is_part);
|
||||
|
||||
void logbuffer_mark_read(struct logbuffer_s *lb, int n);
|
||||
|
||||
void logbuffer_free(struct logbuffer_s *lb);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -771,6 +771,9 @@ void sdlog2_stop_log()
|
||||
/* free log writer performance counter */
|
||||
perf_free(perf_write);
|
||||
|
||||
/* free log buffer */
|
||||
logbuffer_free(&lb);
|
||||
|
||||
mavlink_and_console_log_info(mavlink_fd, "[blackbox] recording stopped");
|
||||
|
||||
sdlog2_status();
|
||||
|
||||
Reference in New Issue
Block a user