Only do save_errno = errno and errno = save_errno around g_free();

There is *no* need to do it around an assignment statement.  (We
*probably* don't need to do it around g_free(), but better safe than
sorry - maybe some memory allocator makes system calls to hand regions
of the address space back.)

Change-Id: Ib57540cc36b505aadf4a5e8885b9a744a35b1f75
Reviewed-on: https://code.wireshark.org/review/20236
Reviewed-by: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Guy Harris 2017-02-21 17:41:55 -08:00
parent 50dff6eac4
commit 0327078837
1 changed files with 5 additions and 7 deletions

View File

@ -1549,10 +1549,10 @@ create_persconffile_profile(const char *profilename, char **pf_dir_path_return)
#ifdef _WIN32
char *pf_dir_path_copy, *pf_dir_parent_path;
size_t pf_dir_parent_path_len;
int save_errno;
#endif
ws_statb64 s_buf;
int ret;
int save_errno;
if (profilename) {
/*
@ -1570,9 +1570,7 @@ create_persconffile_profile(const char *profilename, char **pf_dir_path_return)
if (ws_stat64(pf_dir_path, &s_buf) != 0) {
if (errno != ENOENT) {
/* Some other problem; give up now. */
save_errno = errno;
*pf_dir_path_return = pf_dir_path;
errno = save_errno;
return -1;
}
@ -1592,9 +1590,7 @@ create_persconffile_profile(const char *profilename, char **pf_dir_path_return)
if (ws_stat64(pf_dir_path, &s_buf) != 0) {
if (errno != ENOENT) {
/* Some other problem; give up now. */
save_errno = errno;
*pf_dir_path_return = pf_dir_path;
errno = save_errno;
return -1;
}
#ifdef _WIN32
@ -1620,10 +1616,10 @@ create_persconffile_profile(const char *profilename, char **pf_dir_path_return)
*/
if (errno != ENOENT) {
/* Some other problem; give up now. */
save_errno = errno;
*pf_dir_path_return = pf_dir_path;
errno = save_errno;
save_errno = errno;
g_free(pf_dir_path_copy);
errno = save_errno;
return -1;
}
/*
@ -1632,7 +1628,9 @@ 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;
save_errno = errno;
g_free(pf_dir_path);
errno = save_errno;
return -1;
}
}