bugfix: don't crash, if tag_save_literal == NULL
[obnox/wireshark/wip.git] / filters.c
index 86f570c520ad1e86740eab97d62602384e934d91..f24f1d30c801ffbdcf41c6e4b22ca8969c2581a0 100644 (file)
--- a/filters.c
+++ b/filters.c
@@ -78,7 +78,7 @@ static GList *display_filters = NULL;
 #define INIT_BUF_SIZE  128
 
 void
-read_filter_list(filter_list_type_t list, const char **pref_path_return,
+read_filter_list(filter_list_type_t list, char **pref_path_return,
     int *errno_return)
 {
   const char *ff_name;
@@ -423,7 +423,7 @@ remove_from_filter_list(filter_list_type_t list, GList *fl_entry)
  * and "*errno_return" is set to the error.
  */
 void
-save_filter_list(filter_list_type_t list, const char **pref_path_return,
+save_filter_list(filter_list_type_t list, char **pref_path_return,
     int *errno_return)
 {
   const gchar *ff_name;
@@ -458,8 +458,7 @@ save_filter_list(filter_list_type_t list, const char **pref_path_return,
   /* Write to "XXX.new", and rename if that succeeds.
      That means we don't trash the file if we fail to write it out
      completely. */
-  ff_path_new = (gchar *) g_malloc(strlen(ff_path) + 5);
-  sprintf(ff_path_new, "%s.new", ff_path);
+  ff_path_new = g_strdup_printf("%s.new", ff_path);
 
   if ((ff = fopen(ff_path_new, "w")) == NULL) {
     *pref_path_return = ff_path;