mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
deco: _really_ make sure the deco state is fully initialized
I incorrectly thought that 'ci_pointing_to_guiding_tissue' was the only missing initialization, because that is the only one valgrind pointed at. ... that is, until I started looking at a few more dives, which showed that there were other parts tht weren't initialized either, like double tolerated_by_tissue[16]; double tissue_inertgas_saturation[16]; double crushing_onset_tension[16]; // total inert gas tension in the t* moment so just make sure to clear the whole data structure, to avoid any random behavior due to uninitialized deco state. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
0e00d40ead
commit
a2028cd6ef
1 changed files with 2 additions and 0 deletions
|
@ -540,6 +540,8 @@ void clear_vpmb_state(struct deco_state *ds) {
|
|||
void clear_deco(struct deco_state *ds, double surface_pressure)
|
||||
{
|
||||
int ci;
|
||||
|
||||
memset(ds, 0, sizeof(*ds));
|
||||
clear_vpmb_state(ds);
|
||||
for (ci = 0; ci < 16; ci++) {
|
||||
ds->tissue_n2_sat[ci] = (surface_pressure - ((in_planner() && (decoMode() == VPMB)) ? WV_PRESSURE_SCHREINER : WV_PRESSURE)) * N2_IN_AIR / 1000;
|
||||
|
|
Loading…
Reference in a new issue