mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-19 14:25:27 +00:00
Cleanup: avoid resource leak in dive planner model
Found by Coverity. Fixes CID 350121 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
4f9783ff60
commit
c9a39bb08e
1 changed files with 3 additions and 5 deletions
|
@ -1014,8 +1014,10 @@ void DivePlannerPointsModel::computeVariationsFreeDeco(struct diveplan *original
|
||||||
|
|
||||||
void DivePlannerPointsModel::computeVariations(struct diveplan *original_plan, const struct deco_state *previous_ds)
|
void DivePlannerPointsModel::computeVariations(struct diveplan *original_plan, const struct deco_state *previous_ds)
|
||||||
{
|
{
|
||||||
|
// nothing to do unless there's an original plan
|
||||||
|
if (!original_plan)
|
||||||
|
return;
|
||||||
|
|
||||||
// bool oldRecalc = setRecalc(false);
|
|
||||||
struct dive *dive = alloc_dive();
|
struct dive *dive = alloc_dive();
|
||||||
copy_dive(&displayed_dive, dive);
|
copy_dive(&displayed_dive, dive);
|
||||||
struct decostop original[60], deeper[60], shallower[60], shorter[60], longer[60];
|
struct decostop original[60], deeper[60], shallower[60], shorter[60], longer[60];
|
||||||
|
@ -1024,10 +1026,6 @@ void DivePlannerPointsModel::computeVariations(struct diveplan *original_plan, c
|
||||||
struct divedatapoint *last_segment;
|
struct divedatapoint *last_segment;
|
||||||
struct deco_state ds = *previous_ds;
|
struct deco_state ds = *previous_ds;
|
||||||
|
|
||||||
if (!original_plan)
|
|
||||||
return;
|
|
||||||
|
|
||||||
|
|
||||||
if (in_planner() && prefs.display_variations && decoMode() != RECREATIONAL) {
|
if (in_planner() && prefs.display_variations && decoMode() != RECREATIONAL) {
|
||||||
int my_instance = ++instanceCounter;
|
int my_instance = ++instanceCounter;
|
||||||
cache_deco_state(&ds, &save);
|
cache_deco_state(&ds, &save);
|
||||||
|
|
Loading…
Add table
Reference in a new issue