mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
Fix theoretical uninitialized read
We should never read cur_pr[cyl] if cyl isn't used during a dive - but for cylinders that are used cur_pr[cyl] is initialized. But just to catch errors elsewhere, let's not leave cur_pr[cyl] uninitialized. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
8ab1fa3983
commit
211ff0e63b
1 changed files with 4 additions and 1 deletions
|
@ -585,8 +585,11 @@ static void fill_missing_tank_pressures(struct dive *dive, struct plot_info *pi,
|
||||||
dump_pr_track(track_pr);
|
dump_pr_track(track_pr);
|
||||||
#endif
|
#endif
|
||||||
for (cyl = 0; cyl < MAX_CYLINDERS; cyl++) {
|
for (cyl = 0; cyl < MAX_CYLINDERS; cyl++) {
|
||||||
if (!track_pr[cyl])
|
if (!track_pr[cyl]) {
|
||||||
|
/* no segment where this cylinder is used */
|
||||||
|
cur_pr[cyl] = -1;
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
fill_missing_segment_pressures(track_pr[cyl]);
|
fill_missing_segment_pressures(track_pr[cyl]);
|
||||||
cur_pr[cyl] = track_pr[cyl]->start;
|
cur_pr[cyl] = track_pr[cyl]->start;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue