diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-02-21 17:41:55 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-02-22 01:42:35 +0000 |
commit | 0327078837bb5189c53080ef259d99e6c7075e6b (patch) | |
tree | 90071defac87640cc960245c5b0c02e1dc086231 /wsutil/filesystem.c | |
parent | 50dff6eac41bbe22e1436af1301628eb3462bf8a (diff) |
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>
Diffstat (limited to 'wsutil/filesystem.c')
-rw-r--r-- | wsutil/filesystem.c | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/wsutil/filesystem.c b/wsutil/filesystem.c index 1f9997eaff..33c78655d5 100644 --- a/wsutil/filesystem.c +++ b/wsutil/filesystem.c @@ -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; } } |