diff options
author | Anders Broman <anders.broman@ericsson.com> | 2012-04-14 07:36:47 +0000 |
---|---|---|
committer | Anders Broman <anders.broman@ericsson.com> | 2012-04-14 07:36:47 +0000 |
commit | ff2840fc2f6e24dfa7afb6f612576dfca6bae0e8 (patch) | |
tree | 81f426dba8ee02cf7a0b0e6fde6931046534991e /ui/gtk/graph_analysis.c | |
parent | de42012ffd3bb3c326b344af15f61a289cd73520 (diff) |
From Evan Huus: Memory leaks in graph_analysis.c https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=7082 changed to not allocating time_str unless needed.
svn path=/trunk/; revision=42060
Diffstat (limited to 'ui/gtk/graph_analysis.c')
-rw-r--r-- | ui/gtk/graph_analysis.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ui/gtk/graph_analysis.c b/ui/gtk/graph_analysis.c index 982bc7659b..202a72ee2d 100644 --- a/ui/gtk/graph_analysis.c +++ b/ui/gtk/graph_analysis.c @@ -308,7 +308,7 @@ static gboolean dialog_graph_dump_to_file(graph_analysis_data_t *user_data) GString *label_string, *empty_line,*separator_line, *tmp_str, *tmp_str2; char *empty_header; char src_port[8],dst_port[8]; - gchar *time_str = g_malloc(COL_MAX_LEN); + gchar *time_str; GList *list; FILE *of; @@ -319,6 +319,7 @@ static gboolean dialog_graph_dump_to_file(graph_analysis_data_t *user_data) return FALSE; } + time_str = g_malloc(COL_MAX_LEN); label_string = g_string_new(""); empty_line = g_string_new(""); separator_line = g_string_new(""); @@ -666,7 +667,7 @@ static void dialog_graph_draw(graph_analysis_data_t *user_data) char label_string[MAX_COMMENT]; GList *list; cairo_t *cr; - gchar *time_str = g_malloc(COL_MAX_LEN); + gchar *time_str; GdkColor *color_p, *bg_color_p; GdkColor black_color = {0, 0, 0, 0}; @@ -691,7 +692,7 @@ static void dialog_graph_draw(graph_analysis_data_t *user_data) }; /* XXX can't we just set the background color ? */ - GdkPixbuf *bg_pixbuf = gdk_pixbuf_new_from_xpm_data(voip_bg_xpm); + GdkPixbuf *bg_pixbuf; /* Dashed line pattern */ static const double dashed1[] = {5.0, 4.0}; @@ -702,6 +703,9 @@ static void dialog_graph_draw(graph_analysis_data_t *user_data) if(!user_data->dlg.needs_redraw){ return; } + + bg_pixbuf = gdk_pixbuf_new_from_xpm_data(voip_bg_xpm); + time_str = g_malloc(COL_MAX_LEN); user_data->dlg.needs_redraw=FALSE; gtk_widget_get_allocation(user_data->dlg.draw_area_time, &draw_area_time_alloc); |