diff options
Diffstat (limited to 'source3/smbwrapper/smbw_dir.c')
-rw-r--r-- | source3/smbwrapper/smbw_dir.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/source3/smbwrapper/smbw_dir.c b/source3/smbwrapper/smbw_dir.c index d9dae454bb..6cbc34391f 100644 --- a/source3/smbwrapper/smbw_dir.c +++ b/source3/smbwrapper/smbw_dir.c @@ -64,12 +64,12 @@ free a smbw_dir structure and all entries *******************************************************/ static void free_dir(struct smbw_dir *dir) { - if (dir->list) { - free(dir->list); - } - if (dir->path) free(dir->path); + if(!dir) return; + + SAFE_FREE(dir->list); + SAFE_FREE(dir->path); ZERO_STRUCTP(dir); - free(dir); + SAFE_FREE(dir); } static struct smbw_dir *cur_dir; @@ -274,10 +274,8 @@ int smbw_dir_open(const char *fname) return dir->fd; failed: - if (dir) { - free_dir(dir); - } - + free_dir(dir); + return -1; } |