summaryrefslogtreecommitdiff
path: root/source3/smbwrapper
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2001-09-17 11:25:41 +0000
committerSimo Sorce <idra@samba.org>2001-09-17 11:25:41 +0000
commit61b2794968faa35dc91edce17e9b91e5366c3514 (patch)
tree3fd9ec24adcdf149263066754f5e51ac7a4e14e0 /source3/smbwrapper
parent87945989c0383bd012be7ab8bc5920b6d03fa105 (diff)
downloadsamba-61b2794968faa35dc91edce17e9b91e5366c3514.tar.gz
samba-61b2794968faa35dc91edce17e9b91e5366c3514.tar.bz2
samba-61b2794968faa35dc91edce17e9b91e5366c3514.zip
move to SAFE_FREE()
(This used to be commit a95943fde0ad89ae3f2deca2f7ba9cb5ab612b74)
Diffstat (limited to 'source3/smbwrapper')
-rw-r--r--source3/smbwrapper/smbw.c30
-rw-r--r--source3/smbwrapper/smbw_cache.c6
-rw-r--r--source3/smbwrapper/smbw_dir.c16
3 files changed, 24 insertions, 28 deletions
diff --git a/source3/smbwrapper/smbw.c b/source3/smbwrapper/smbw.c
index d5b61ac997..5702ea51ca 100644
--- a/source3/smbwrapper/smbw.c
+++ b/source3/smbwrapper/smbw.c
@@ -281,13 +281,13 @@ static char *smbw_find_workgroup(void)
slprintf(server, sizeof(server), "%s#1D", name);
if (smbw_server(server, "IPC$")) {
smbw_setshared("WORKGROUP", name);
- free(ip_list);
+ SAFE_FREE(ip_list);
return name;
}
}
}
- free(ip_list);
+ SAFE_FREE(ip_list);
return p;
}
@@ -606,9 +606,9 @@ struct smbw_server *smbw_server(char *server, char *share)
cli_shutdown(&c);
if (!srv) return NULL;
- if (srv->server_name) free(srv->server_name);
- if (srv->share_name) free(srv->share_name);
- free(srv);
+ SAFE_FREE(srv->server_name);
+ SAFE_FREE(srv->share_name);
+ SAFE_FREE(srv);
return NULL;
}
@@ -722,12 +722,10 @@ int smbw_open(const char *fname, int flags, mode_t mode)
}
if (file) {
if (file->f) {
- if (file->f->fname) {
- free(file->f->fname);
- }
- free(file->f);
+ SAFE_FREE(file->f->fname);
+ SAFE_FREE(file->f);
}
- free(file);
+ SAFE_FREE(file);
}
smbw_busy--;
return -1;
@@ -892,11 +890,11 @@ int smbw_close(int fd)
file->f->ref_count--;
if (file->f->ref_count == 0) {
- free(file->f->fname);
- free(file->f);
+ SAFE_FREE(file->f->fname);
+ SAFE_FREE(file->f);
}
ZERO_STRUCTP(file);
- free(file);
+ SAFE_FREE(file);
smbw_busy--;
@@ -1384,14 +1382,14 @@ static void smbw_srv_close(struct smbw_server *srv)
cli_shutdown(&srv->cli);
- free(srv->server_name);
- free(srv->share_name);
+ SAFE_FREE(srv->server_name);
+ SAFE_FREE(srv->share_name);
DLIST_REMOVE(smbw_srvs, srv);
ZERO_STRUCTP(srv);
- free(srv);
+ SAFE_FREE(srv);
smbw_busy--;
}
diff --git a/source3/smbwrapper/smbw_cache.c b/source3/smbwrapper/smbw_cache.c
index 3213d99941..13a68e7454 100644
--- a/source3/smbwrapper/smbw_cache.c
+++ b/source3/smbwrapper/smbw_cache.c
@@ -87,9 +87,9 @@ static void free_name_list(struct name_list *name_list)
next = tmp->next;
- free(tmp->name);
- free(tmp->comment);
- free(tmp);
+ SAFE_FREE(tmp->name);
+ SAFE_FREE(tmp->comment);
+ SAFE_FREE(tmp);
tmp = next;
}
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;
}