diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2019-07-06 14:41:09 +0200 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2019-07-06 11:23:35 -0700 |
commit | 69be1e23f231081e6bad98903c10782faf5104a7 (patch) | |
tree | bf8ca85183983f6adebd494c59c80663cb33f48c /core/profile.h | |
parent | 5e9ffe30053454ef9d058c7e7d41f55508cb66d7 (diff) | |
download | subsurface-69be1e23f231081e6bad98903c10782faf5104a7.tar.gz |
Cleanup: fix memory management of the plot data
There was a global variable last_pi_entry_new, which stored the
recently allocated plot data. This was freed when new plot data
was generated.
A very scary proposition: You can never have two plot datas at
the same time! But exactly that happens when you export for
example subtitles.
The only reason why this didn't lead to very crazy behavior
is that at least on my Linux machine, the calloc() call would
just return the previously freed memory.
Fix this mess by removing the global variable and freeing the
data in the callers.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/profile.h')
-rw-r--r-- | core/profile.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/profile.h b/core/profile.h index b0828c48f..125e349a8 100644 --- a/core/profile.h +++ b/core/profile.h @@ -75,11 +75,11 @@ struct ev_select { struct plot_info calculate_max_limits_new(struct dive *dive, struct divecomputer *given_dc); void compare_samples(struct plot_data *e1, struct plot_data *e2, char *buf, int bufsize, int sum); -struct plot_data *populate_plot_entries(struct dive *dive, struct divecomputer *dc, struct plot_info *pi); struct plot_info *analyze_plot_info(struct plot_info *pi); void create_plot_info_new(struct dive *dive, struct divecomputer *dc, struct plot_info *pi, bool fast, struct deco_state *planner_ds); void calculate_deco_information(struct deco_state *ds, const struct deco_state *planner_de, const struct dive *dive, const struct divecomputer *dc, struct plot_info *pi, bool print_mode); struct plot_data *get_plot_details_new(struct plot_info *pi, int time, struct membuffer *); +void free_plot_info_data(struct plot_info *pi); /* * When showing dive profiles, we scale things to the |