fix(load_mon): add return code at module stop path (#28544)

* fix uaf bug in load_mon module

* fix(load_mon): end the perf cycle before deleting the module

exit_and_cleanup() deletes this and frees _cycle_perf, so the elapsed counter has to be closed on the live object.

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>

---------

Signed-off-by: Jacob Dahl <dahl.jakejacob@gmail.com>
Co-authored-by: Jacob Dahl <dahl.jakejacob@gmail.com>
This commit is contained in:
XiaoYang ChenandJacob Dahl authored and GitHub committed 2026-09-04 13:25:32 -06:00
1 parent f8387d19a1
commit 354823e2ef
1 file changed
+3 -2
+3 -2
View File
@@ -111,15 +111,16 @@ void LoadMon::Run()
#endif
perf_end(_cycle_perf);
if (should_exit()) {
ScheduleClear();
#if defined (__PX4_LINUX)
fclose(_proc_fd);
#endif
exit_and_cleanup(desc);
return;
}
perf_end(_cycle_perf);
}
void LoadMon::cpuload()