aboutsummaryrefslogtreecommitdiffstats
path: root/trace-plot.c
diff options
context:
space:
mode:
Diffstat (limited to 'trace-plot.c')
-rw-r--r--trace-plot.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/trace-plot.c b/trace-plot.c
index 37b5cfc..5ba2ec1 100644
--- a/trace-plot.c
+++ b/trace-plot.c
@@ -3,10 +3,19 @@
3 3
4void trace_graph_plot_free(struct graph_info *ginfo) 4void trace_graph_plot_free(struct graph_info *ginfo)
5{ 5{
6 struct graph_plot **array;
7 int plots;
6 int i; 8 int i;
7 9
8 for (i = 0; i < ginfo->plots; i++) 10 /* copy the plot_array since the removing plots will modify it */
9 free(ginfo->plot_array[i]); 11 array = malloc_or_die(sizeof(*array) * ginfo->plots);
12 memcpy(array, ginfo->plot_array, sizeof(*array) * ginfo->plots);
13 plots = ginfo->plots;
14
15
16 for (i = 0; i < plots; i++)
17 trace_graph_plot_remove(ginfo, array[i]);
18 free(array);
10 19
11 if (ginfo->plot_array) { 20 if (ginfo->plot_array) {
12 free(ginfo->plot_array); 21 free(ginfo->plot_array);