diff options
| author | Steven Rostedt <srostedt@redhat.com> | 2010-02-10 18:42:51 -0500 |
|---|---|---|
| committer | Steven Rostedt <rostedt@goodmis.org> | 2010-02-10 18:42:51 -0500 |
| commit | d3e8c138b5fc9dca6f03fc31660117417e9ca321 (patch) | |
| tree | 1e90f927edad1861c2d38d03594adbdb0ea2fed0 | |
| parent | f4258f18687ea19e38eccb8c7badb451d3d2d5e2 (diff) | |
trace-graph: Clean up plots when reloading a new trace.dat
Need to destroy the the plots with the full destructor when removing
them before loading a new trace.dat file.
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
| -rw-r--r-- | trace-plot.c | 13 |
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 | ||
| 4 | void trace_graph_plot_free(struct graph_info *ginfo) | 4 | void 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); |
