mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Planner: correctly free divedatapoints
Simply setting the pointer to NULL leaks memory. And that C++ recursive two function implementation... oh boy. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
6ed189f32c
commit
77f9bf06fd
4 changed files with 10 additions and 16 deletions
|
|
@ -348,13 +348,17 @@ gas_error_exit:
|
|||
return;
|
||||
}
|
||||
|
||||
void free_dps(struct divedatapoint *dp)
|
||||
void free_dps(struct diveplan *diveplan)
|
||||
{
|
||||
if (!diveplan)
|
||||
return;
|
||||
struct divedatapoint *dp = diveplan->dp;
|
||||
while (dp) {
|
||||
struct divedatapoint *ndp = dp->next;
|
||||
free(dp);
|
||||
dp = ndp;
|
||||
}
|
||||
diveplan->dp = NULL;
|
||||
}
|
||||
|
||||
struct divedatapoint *create_dp(int time_incr, int depth, struct gasmix gasmix, int po2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue