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>
This commit is contained in:
Berthold Stoeger 2020-04-17 21:14:01 +02:00 committed by bstoeger
parent af753a52e3
commit b1f8b6b950

View file

@ -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)