mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-22 00:28:30 -04:00
AP_Mission: read_cmd_from_storage sets all bytes of cmd
This resolves a potential valgrind issue caused by some bytes of the cmd not being set
This commit is contained in:
parent
2c95093d36
commit
b873e7fcb0
@ -625,9 +625,8 @@ bool AP_Mission::read_cmd_from_storage(uint16_t index, Mission_Command& cmd) con
|
||||
|
||||
// special handling for command #0 which is home
|
||||
if (index == 0) {
|
||||
cmd.index = 0;
|
||||
cmd = {};
|
||||
cmd.id = MAV_CMD_NAV_WAYPOINT;
|
||||
cmd.p1 = 0;
|
||||
cmd.content.location = AP::ahrs().get_home();
|
||||
return true;
|
||||
}
|
||||
@ -636,6 +635,9 @@ bool AP_Mission::read_cmd_from_storage(uint16_t index, Mission_Command& cmd) con
|
||||
return false;
|
||||
}
|
||||
|
||||
// ensure all bytes of cmd are zeroed
|
||||
cmd = {};
|
||||
|
||||
// Find out proper location in memory by using the start_byte position + the index
|
||||
// we can load a command, we don't process it yet
|
||||
// read WP position
|
||||
|
Loading…
Reference in New Issue
Block a user