From 554a7aaba4ad1a65a68a7d3e6f8aeece548351b9 Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Fri, 31 Aug 2018 13:46:34 +0200 Subject: [PATCH] Zero initialize deco state struct Valgrind found use of some uninitialized variable (probably ds->gf_low_pressure_this_dive ), see #1614. Zero is the correct value to start with. Lacking a working version of valgrind I cannot check this actually fixes the problem. Signed-off-by: Robert C. Helling --- qt-models/diveplannermodel.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/qt-models/diveplannermodel.cpp b/qt-models/diveplannermodel.cpp index 32231ecca..b2d71d1ef 100644 --- a/qt-models/diveplannermodel.cpp +++ b/qt-models/diveplannermodel.cpp @@ -903,6 +903,7 @@ void DivePlannerPointsModel::createTemporaryPlan() struct deco_state plan_deco_state; struct diveplan *plan_copy; + memset(&plan_deco_state, 0, sizeof(struct deco_state)); plan(&plan_deco_state, &diveplan, &displayed_dive, DECOTIMESTEP, stoptable, &cache, isPlanner(), false); plan_copy = (struct diveplan *)malloc(sizeof(struct diveplan)); lock_planner();