mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-05-22 10:57:34 +08:00
Fix memory leaks identified by cppcheck
* Add `free` / `delete` * Add comment explaining the (presumed) motivation for the use of new instead of allocating on the stack
This commit is contained in:
committed by
Lorenz Meier
parent
5be23060e7
commit
cc1b766824
@@ -1049,6 +1049,8 @@ void Ekf2Replay::task_main()
|
||||
PX4_INFO("TAS innov RMS = %6.3f", (double)sqrtf(_tasInnovSumSq / _numInnovSamples));
|
||||
}
|
||||
|
||||
free(path_to_replay_log);
|
||||
|
||||
}
|
||||
|
||||
void Ekf2Replay::task_main_trampoline(int argc, char *argv[])
|
||||
|
||||
@@ -89,6 +89,7 @@ int uORBTest::UnitTest::pubsublatency_main()
|
||||
const unsigned maxruns = 1000;
|
||||
unsigned timingsgroup = 0;
|
||||
|
||||
// timings has to be on the heap to keep frame size below 2048 bytes
|
||||
unsigned *timings = new unsigned[maxruns];
|
||||
|
||||
for (unsigned i = 0; i < maxruns; i++) {
|
||||
@@ -129,6 +130,7 @@ int uORBTest::UnitTest::pubsublatency_main()
|
||||
|
||||
if (f == nullptr) {
|
||||
warnx("Error opening file!\n");
|
||||
delete[] timings;
|
||||
return uORB::ERROR;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user