mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
profile: clear plot_info structure when freeing data
free_plot_info_data() frees the sample and pressure arrays and accordingly sets the corresponding pointers to NULL. However, it doesn't clear the element-count and thus leaves the structure in an inconsistent state. Clear the whole structure with memset(). I am not a fan of doing so, but there are existing memset() calls in the same source file, so let's keep it like that for consistency. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
564cbc797c
commit
789eb2c620
1 changed files with 1 additions and 2 deletions
|
@ -395,8 +395,7 @@ void free_plot_info_data(struct plot_info *pi)
|
||||||
{
|
{
|
||||||
free(pi->entry);
|
free(pi->entry);
|
||||||
free(pi->pressures);
|
free(pi->pressures);
|
||||||
pi->entry = NULL;
|
memset(pi, 0, sizeof(*pi));
|
||||||
pi->pressures = NULL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void populate_plot_entries(const struct dive *dive, const struct divecomputer *dc, struct plot_info *pi)
|
static void populate_plot_entries(const struct dive *dive, const struct divecomputer *dc, struct plot_info *pi)
|
||||||
|
|
Loading…
Add table
Reference in a new issue