summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Berthold Stoeger <bstoeger@mail.tuwien.ac.at>2020-04-17 21:14:01 +0200
committerGravatar bstoeger <32835590+bstoeger@users.noreply.github.com>2020-04-18 11:17:32 +0200
commitb1f8b6b9505ea51d951202af1bc909704558293f (patch)
tree04462ef57a761d1ec10fd9a45955ff42ce26b76d
parentaf753a52e3f08057f90b047524a806e64f835f00 (diff)
downloadsubsurface-b1f8b6b9505ea51d951202af1bc909704558293f.tar.gz
profile: avoid double-free when reusing plot_info
free_plot_info_data() freed the pressure-data, but didn't set the value to NULL. Thus, when the plot_info was reused, a double-free() could ensue. Crash condition: export the profiles of multiple dives with pressure data. Reported-by: Willem Ferguson <willemferguson@zoology.up.ac.za> Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
-rw-r--r--core/profile.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/core/profile.c b/core/profile.c
index 26488cc30..6914b8301 100644
--- a/core/profile.c
+++ b/core/profile.c
@@ -499,6 +499,7 @@ void free_plot_info_data(struct plot_info *pi)
free(pi->entry);
free(pi->pressures);
pi->entry = NULL;
+ pi->pressures = NULL;
}
static void populate_plot_entries(struct dive *dive, struct divecomputer *dc, struct plot_info *pi)