summaryrefslogtreecommitdiff
path: root/ui/gtk/hostlist_table.c
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2012-06-03 22:03:05 +0000
committerGuy Harris <guy@alum.mit.edu>2012-06-03 22:03:05 +0000
commitdbfb305368f0178348fd613665a5f5bf05f62d8a (patch)
treeb9609c547a4181a21a0de0b99e1e22a577782b69 /ui/gtk/hostlist_table.c
parentd1c1455882aa50f5ffdb5ba5dfdd6c4a4a45f649 (diff)
downloadwireshark-dbfb305368f0178348fd613665a5f5bf05f62d8a.tar.gz
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/hostlist_table.c')
-rw-r--r--ui/gtk/hostlist_table.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/ui/gtk/hostlist_table.c b/ui/gtk/hostlist_table.c
index c56ca9f383..4f67b52fad 100644
--- a/ui/gtk/hostlist_table.c
+++ b/ui/gtk/hostlist_table.c
@@ -181,6 +181,7 @@ static void
reset_hostlist_table_data(hostlist_table *hosts)
{
guint32 i;
+ char *display_name;
char title[256];
GString *error_string;
const char *filter;
@@ -200,7 +201,9 @@ reset_hostlist_table_data(hostlist_table *hosts)
if(hosts->page_lb) {
- g_snprintf(title, sizeof(title), "Endpoints: %s", cf_get_display_name(&cfile));
+ display_name = cf_get_display_name(&cfile);
+ g_snprintf(title, sizeof(title), "Endpoints: %s", display_name);
+ g_free(display_name);
gtk_window_set_title(GTK_WINDOW(hosts->win), title);
g_snprintf(title, sizeof(title), "%s", hosts->name);
gtk_label_set_text(GTK_LABEL(hosts->page_lb), title);
@@ -217,7 +220,9 @@ reset_hostlist_table_data(hostlist_table *hosts)
}
gtk_label_set_text(GTK_LABEL(hosts->name_lb), title);
} else {
- g_snprintf(title, sizeof(title), "%s Endpoints: %s", hosts->name, cf_get_display_name(&cfile));
+ display_name = cf_get_display_name(&cfile);
+ g_snprintf(title, sizeof(title), "%s Endpoints: %s", hosts->name, display_name);
+ g_free(display_name);
gtk_window_set_title(GTK_WINDOW(hosts->win), title);
}
@@ -1373,6 +1378,7 @@ void
init_hostlist_table(gboolean hide_ports, const char *table_name, const char *tap_name, const char *filter, tap_packet_cb packet_func)
{
hostlist_table *hosttable;
+ char *display_name;
char title[256];
GtkWidget *vbox;
GtkWidget *bbox;
@@ -1388,7 +1394,9 @@ init_hostlist_table(gboolean hide_ports, const char *table_name, const char *tap
hosttable->name=table_name;
hosttable->filter=filter;
hosttable->use_dfilter=FALSE;
- g_snprintf(title, sizeof(title), "%s Endpoints: %s", table_name, cf_get_display_name(&cfile));
+ display_name = cf_get_display_name(&cfile);
+ g_snprintf(title, sizeof(title), "%s Endpoints: %s", table_name, display_name);
+ g_free(display_name);
hosttable->win = dlg_window_new(title); /* transient_for top_level */
gtk_window_set_destroy_with_parent (GTK_WINDOW(hosttable->win), TRUE);
@@ -1601,6 +1609,7 @@ void
init_hostlist_notebook_cb(GtkWidget *w _U_, gpointer d _U_)
{
hostlist_table *hosttable;
+ char *display_name;
char title[256];
GtkWidget *vbox;
GtkWidget *hbox;
@@ -1626,7 +1635,9 @@ init_hostlist_notebook_cb(GtkWidget *w _U_, gpointer d _U_)
win = dlg_window_new("hostlist"); /* transient_for top_level */
gtk_window_set_destroy_with_parent (GTK_WINDOW(win), TRUE);
- g_snprintf(title, sizeof(title), "Endpoints: %s", cf_get_display_name(&cfile));
+ display_name = cf_get_display_name(&cfile);
+ g_snprintf(title, sizeof(title), "Endpoints: %s", display_name);
+ g_free(display_name);
gtk_window_set_title(GTK_WINDOW(win), title);
gtk_window_set_default_size(GTK_WINDOW(win), 750, 400);