gtk: Fix memory error/double free.

pathname is freed by caller of firewall_save_as_ok_cb(). Make pathname const.
Found by clang scan.

Change-Id: I3a0ab85494a9194edb825bae33eca979c7f8faf3
Reviewed-on: https://code.wireshark.org/review/25417
Petri-Dish: Jakub Zawadzki <darkjames-ws@darkjames.pl>
Tested-by: Petri Dish Buildbot
Reviewed-by: Jakub Zawadzki <darkjames-ws@darkjames.pl>
This commit is contained in:
Jakub Zawadzki 2018-01-22 18:28:16 +01:00
parent 862c881318
commit e6eb4815cd
1 changed files with 1 additions and 2 deletions

View File

@ -462,7 +462,7 @@ firewall_copy_cmd_cb(GtkWidget *w _U_, gpointer data)
}
static gboolean
firewall_save_as_ok_cb(char *to_name, rule_info_t *rule_info)
firewall_save_as_ok_cb(const char *to_name, rule_info_t *rule_info)
{
FILE *fh;
gchar *rule;
@ -473,7 +473,6 @@ firewall_save_as_ok_cb(char *to_name, rule_info_t *rule_info)
fh = ws_fopen(to_name, "w");
if (fh == NULL) {
open_failure_alert_box(to_name, errno, TRUE);
g_free(to_name);
return FALSE;
}