summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2012-02-24 17:16:08 -0800
committerJeremy Allison <jra@samba.org>2012-02-25 03:50:24 +0100
commit872fb6a3e0c6d95b7ff754d1a277d24d6a51ecaf (patch)
treefd672127f62b17558c71d9d00ec4366d77461b5f /source3
parente54cf1538752fcb38fd9ce84345520c4d0001474 (diff)
downloadsamba-872fb6a3e0c6d95b7ff754d1a277d24d6a51ecaf.tar.gz
samba-872fb6a3e0c6d95b7ff754d1a277d24d6a51ecaf.tar.bz2
samba-872fb6a3e0c6d95b7ff754d1a277d24d6a51ecaf.zip
Move dptr code over to TALLOC.
Autobuild-User: Jeremy Allison <jra@samba.org> Autobuild-Date: Sat Feb 25 03:50:24 CET 2012 on sn-devel-104
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/dir.c27
1 files changed, 9 insertions, 18 deletions
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c
index f3cc36e872..d4faf42fe0 100644
--- a/source3/smbd/dir.c
+++ b/source3/smbd/dir.c
@@ -281,11 +281,7 @@ static void dptr_close_internal(struct dptr_struct *dptr)
done:
TALLOC_FREE(dptr->dir_hnd);
-
- /* Lanman 2 specific code */
- SAFE_FREE(dptr->wcard);
- SAFE_FREE(dptr->path);
- SAFE_FREE(dptr);
+ TALLOC_FREE(dptr);
}
/****************************************************************************
@@ -494,18 +490,18 @@ NTSTATUS dptr_create(connection_struct *conn, files_struct *fsp,
dptr_idleoldest(sconn);
}
- dptr = SMB_MALLOC_P(struct dptr_struct);
+ dptr = talloc(NULL, struct dptr_struct);
if(!dptr) {
- DEBUG(0,("malloc fail in dptr_create.\n"));
+ DEBUG(0,("talloc fail in dptr_create.\n"));
TALLOC_FREE(dir_hnd);
return NT_STATUS_NO_MEMORY;
}
ZERO_STRUCTP(dptr);
- dptr->path = SMB_STRDUP(path);
+ dptr->path = talloc_strdup(dptr, path);
if (!dptr->path) {
- SAFE_FREE(dptr);
+ TALLOC_FREE(dptr);
TALLOC_FREE(dir_hnd);
return NT_STATUS_NO_MEMORY;
}
@@ -513,10 +509,9 @@ NTSTATUS dptr_create(connection_struct *conn, files_struct *fsp,
dptr->dir_hnd = dir_hnd;
dptr->spid = spid;
dptr->expect_close = expect_close;
- dptr->wcard = SMB_STRDUP(wcard);
+ dptr->wcard = talloc_strdup(dptr, wcard);
if (!dptr->wcard) {
- SAFE_FREE(dptr->path);
- SAFE_FREE(dptr);
+ TALLOC_FREE(dptr);
TALLOC_FREE(dir_hnd);
return NT_STATUS_NO_MEMORY;
}
@@ -555,9 +550,7 @@ NTSTATUS dptr_create(connection_struct *conn, files_struct *fsp,
dptr->dnum = bitmap_find(sconn->searches.dptr_bmap, 0);
if(dptr->dnum == -1 || dptr->dnum > 254) {
DEBUG(0,("dptr_create: returned %d: Error - all old dirptrs in use ?\n", dptr->dnum));
- SAFE_FREE(dptr->path);
- SAFE_FREE(dptr->wcard);
- SAFE_FREE(dptr);
+ TALLOC_FREE(dptr);
TALLOC_FREE(dir_hnd);
return NT_STATUS_TOO_MANY_OPENED_FILES;
}
@@ -587,9 +580,7 @@ NTSTATUS dptr_create(connection_struct *conn, files_struct *fsp,
if(dptr->dnum == -1 || dptr->dnum < 255) {
DEBUG(0,("dptr_create: returned %d: Error - all new dirptrs in use ?\n", dptr->dnum));
- SAFE_FREE(dptr->path);
- SAFE_FREE(dptr->wcard);
- SAFE_FREE(dptr);
+ TALLOC_FREE(dptr);
TALLOC_FREE(dir_hnd);
return NT_STATUS_TOO_MANY_OPENED_FILES;
}