aboutsummaryrefslogtreecommitdiffstats
path: root/wsutil/filesystem.c
diff options
context:
space:
mode:
authorGerald Combs <gerald@wireshark.org>2017-02-21 09:57:16 -0800
committerGuy Harris <guy@alum.mit.edu>2017-02-21 19:03:43 +0000
commit012a179785abada629fa324652755c6acb51be74 (patch)
treeaae93d60d53ba7dd5aabfbad2b80ce3d3fb0df1d /wsutil/filesystem.c
parentf04e7702c48f1c57568f1c6c21a093e71513b2c2 (diff)
Fix a double free.
In create_persconffile_profile, pf_dir_path_copy needs to be allocated separately since the subsequent call to get_dirname is destructive. Add back a call to g_strdup. This should hopefully fix a crash in the Win32 buildbot. Change-Id: I591b5845032c9b8a5324bf6ac60fc43d1e92ac2e Reviewed-on: https://code.wireshark.org/review/20231 Reviewed-by: Gerald Combs <gerald@wireshark.org> Petri-Dish: Gerald Combs <gerald@wireshark.org> Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'wsutil/filesystem.c')
-rw-r--r--wsutil/filesystem.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/wsutil/filesystem.c b/wsutil/filesystem.c
index f982435427..1f9997eaff 100644
--- a/wsutil/filesystem.c
+++ b/wsutil/filesystem.c
@@ -1609,7 +1609,7 @@ create_persconffile_profile(const char *profilename, char **pf_dir_path_return)
* doing a "stat()" on it. If it's a drive letter,
* or if the "stat()" succeeds, we assume it exists.
*/
- pf_dir_path_copy = pf_dir_path;
+ pf_dir_path_copy = g_strdup(pf_dir_path);
pf_dir_parent_path = get_dirname(pf_dir_path_copy);
pf_dir_parent_path_len = strlen(pf_dir_parent_path);
if (pf_dir_parent_path_len > 0
@@ -1623,6 +1623,7 @@ create_persconffile_profile(const char *profilename, char **pf_dir_path_return)
save_errno = errno;
*pf_dir_path_return = pf_dir_path;
errno = save_errno;
+ g_free(pf_dir_path_copy);
return -1;
}
/*
@@ -1631,6 +1632,7 @@ create_persconffile_profile(const char *profilename, char **pf_dir_path_return)
ret = ws_mkdir(pf_dir_parent_path, 0755);
if (ret == -1) {
*pf_dir_path_return = pf_dir_parent_path;
+ g_free(pf_dir_path);
return -1;
}
}