summaryrefslogtreecommitdiff
path: root/source3/smbd/dir.c
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/smbd/dir.c
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/smbd/dir.c')
-rw-r--r--source3/smbd/dir.c22
1 files changed, 10 insertions, 12 deletions
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index 9a9c745944..c0c728fe8f 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -246,10 +246,9 @@ static void dptr_close_internal(dptr_struct *dptr)
}
/* Lanman 2 specific code */
- if (dptr->wcard)
- free(dptr->wcard);
+ SAFE_FREE(dptr->wcard);
string_set(&dptr->path,"");
- free((char *)dptr);
+ SAFE_FREE(dptr);
}
/****************************************************************************
@@ -438,7 +437,7 @@ int dptr_create(connection_struct *conn,char *path, BOOL old_handle, BOOL expect
if(dptr->dnum == -1 || dptr->dnum > 254) {
DEBUG(0,("dptr_create: returned %d: Error - all old dirptrs in use ?\n", dptr->dnum));
- free((char *)dptr);
+ SAFE_FREE(dptr);
return -1;
}
}
@@ -467,7 +466,7 @@ int dptr_create(connection_struct *conn,char *path, BOOL old_handle, BOOL expect
if(dptr->dnum == -1 || dptr->dnum < 255) {
DEBUG(0,("dptr_create: returned %d: Error - all new dirptrs in use ?\n", dptr->dnum));
- free((char *)dptr);
+ SAFE_FREE(dptr);
return -1;
}
}
@@ -730,7 +729,7 @@ void *OpenDir(connection_struct *conn, char *name, BOOL use_veto)
if (asprintf(&entry, "%s/%s/%s", conn->origpath, name, n) > 0) {
ret = user_can_read_file(conn, entry);
- free(entry);
+ SAFE_FREE(entry);
}
if (!ret) continue;
}
@@ -763,10 +762,9 @@ void *OpenDir(connection_struct *conn, char *name, BOOL use_veto)
void CloseDir(void *p)
{
- Dir *dirp = (Dir *)p;
- if (!dirp) return;
- if (dirp->data) free(dirp->data);
- free(dirp);
+ if (!p) return;
+ SAFE_FREE(((Dir *)p)->data);
+ SAFE_FREE(p);
}
/*******************************************************************
@@ -875,7 +873,7 @@ void DirCacheAdd( char *path, char *name, char *dname, int snum )
/* Free excess cache entries. */
while( DIRCACHESIZE < dir_cache->count )
- free( ubi_dlRemTail( dir_cache ) );
+ safe_free( ubi_dlRemTail( dir_cache ) );
}
@@ -927,7 +925,7 @@ void DirCacheFlush(int snum)
NULL != entry; ) {
next = ubi_dlNext( entry );
if( entry->snum == snum )
- free( ubi_dlRemThis( dir_cache, entry ) );
+ safe_free( ubi_dlRemThis( dir_cache, entry ) );
entry = (dir_cache_entry *)next;
}
}