diff options
author | Guy Harris <guy@alum.mit.edu> | 2012-06-03 22:03:05 +0000 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2012-06-03 22:03:05 +0000 |
commit | dbfb305368f0178348fd613665a5f5bf05f62d8a (patch) | |
tree | b9609c547a4181a21a0de0b99e1e22a577782b69 /ui/gtk/compare_stat.c | |
parent | d1c1455882aa50f5ffdb5ba5dfdd6c4a4a45f649 (diff) |
g_filename_display_basename() returns a g_mallocated string, so its
callers either need to free it or their callers need to free it or....
This means that cf_get_display_name() must always return a g_mallocated
string and its callers or... must free it.
For some of those callers, create a new set_window_title() routine to do
the work - they're all using the same pattern.
svn path=/trunk/; revision=43047
Diffstat (limited to 'ui/gtk/compare_stat.c')
-rw-r--r-- | ui/gtk/compare_stat.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/ui/gtk/compare_stat.c b/ui/gtk/compare_stat.c index 5354248400..8b49bf7f1f 100644 --- a/ui/gtk/compare_stat.c +++ b/ui/gtk/compare_stat.c @@ -159,11 +159,7 @@ static GtkWidget *radio_TTL, *radio_ON; static void comparestat_set_title(compstat_t *cs) { - char *title; - - title=g_strdup_printf("Compare two capture files: %s", cf_get_display_name(&cfile)); - gtk_window_set_title(GTK_WINDOW(cs->win), title); - g_free(title); + set_window_title(cs->win, "Compare two capture files"); } /* called when new capture starts, when it rescans the packetlist after some prefs have @@ -702,6 +698,7 @@ static void gtk_comparestat_init(const char *optarg, void* userdata _U_) { compstat_t *cs; + char *display_name; char *title_string; char *filter_string; GtkWidget *stat_label; @@ -764,7 +761,9 @@ gtk_comparestat_init(const char *optarg, void* userdata _U_) gtk_container_add(GTK_CONTAINER(cs->win), vbox); gtk_container_set_border_width(GTK_CONTAINER(vbox), 12); - title_string = g_strdup_printf("Compare two capture files: %s", cf_get_display_name(&cfile)); + display_name = cf_get_display_name(&cfile); + title_string = g_strdup_printf("Compare two capture files: %s", display_name); + g_free(display_name); stat_label=gtk_label_new(title_string); g_free(title_string); gtk_box_pack_start(GTK_BOX(vbox), stat_label, FALSE, FALSE, 0); |