From 61b2794968faa35dc91edce17e9b91e5366c3514 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Mon, 17 Sep 2001 11:25:41 +0000 Subject: move to SAFE_FREE() (This used to be commit a95943fde0ad89ae3f2deca2f7ba9cb5ab612b74) --- source3/smbwrapper/smbw_dir.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) (limited to 'source3/smbwrapper/smbw_dir.c') 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; } -- cgit