forked from osmocom/wireshark
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>
This commit is contained in:
parent
f04e7702c4
commit
012a179785
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue