diff options
author | stig <stig@f5534014-38df-0310-8fa8-9805f1628bb7> | 2010-01-25 21:45:17 +0000 |
---|---|---|
committer | stig <stig@f5534014-38df-0310-8fa8-9805f1628bb7> | 2010-01-25 21:45:17 +0000 |
commit | 291bbee696aab41451acc6347f2eb3880ece378f (patch) | |
tree | a12af9c99e82145f5be649195e0ffbc7c2491e64 /epan | |
parent | 5d08b24e9b2c6c4d7019afac79b174a4ff887c7a (diff) |
Handle escape/unescape underscore when read/write the preferences
column.format entries. Also fix a small memory leakage.
git-svn-id: http://anonsvn.wireshark.org/wireshark/trunk@31670 f5534014-38df-0310-8fa8-9805f1628bb7
Diffstat (limited to 'epan')
-rw-r--r-- | epan/prefs.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/epan/prefs.c b/epan/prefs.c index d4915950e5..82556c2826 100644 --- a/epan/prefs.c +++ b/epan/prefs.c @@ -944,6 +944,7 @@ put_string_list(GList *sl) cur_len += fmt_len; } g_free(quoted_str); + g_free(str); clp = clp->next; } @@ -1887,7 +1888,7 @@ set_pref(gchar *pref_name, gchar *value, void *private_data _U_) col_l_elt = g_list_first(col_l); while(col_l_elt) { cfmt = (fmt_data *) g_malloc(sizeof(fmt_data)); - cfmt->title = g_strdup(col_l_elt->data); + cfmt->title = ws_strdup_escape_underscore(col_l_elt->data); col_l_elt = col_l_elt->next; if (strncmp(col_l_elt->data, cust_format, cust_format_len) == 0) { gchar *fmt = g_strdup(col_l_elt->data); @@ -2884,12 +2885,12 @@ write_prefs(char **pf_path_return) col_l = NULL; while (clp) { cfmt = (fmt_data *) clp->data; - col_l = g_list_append(col_l, cfmt->title); + col_l = g_list_append(col_l, ws_strdup_unescape_underscore(cfmt->title)); if ((strcmp(cfmt->fmt, cust_format) == 0) && (cfmt->custom_field)) { gchar *fmt = g_strdup_printf("%s:%s", cfmt->fmt, cfmt->custom_field); col_l = g_list_append(col_l, fmt); } else { - col_l = g_list_append(col_l, cfmt->fmt); + col_l = g_list_append(col_l, g_strdup(cfmt->fmt)); } clp = clp->next; } @@ -2897,8 +2898,7 @@ write_prefs(char **pf_path_return) fprintf (pf, "# Each pair of strings consists of a column title and its format.\n"); fprintf (pf, "%s: %s\n", PRS_COL_FMT, put_string_list(col_l)); /* This frees the list of strings, but not the strings to which it - refers; that's what we want, as we haven't copied those strings, - we just referred to them. */ + refers; they are free'ed in put_string_list(). */ g_list_free(col_l); fprintf (pf, "\n######## User Interface: Font ########\n"); |