diff options
author | Stefan Metzmacher <metze@samba.org> | 2011-11-10 10:39:34 +0100 |
---|---|---|
committer | Stefan Metzmacher <metze@samba.org> | 2011-11-10 12:30:52 +0100 |
commit | 7644547a5523b77bd49d9a5d979d5e4939153401 (patch) | |
tree | fa1e0f459d65ab5fb2cf1330798b23a91df390d7 /source3/smbd | |
parent | 538748132fbf6bcc1ce0bbd474e4abf3ecdabffa (diff) | |
download | samba-7644547a5523b77bd49d9a5d979d5e4939153401.tar.gz samba-7644547a5523b77bd49d9a5d979d5e4939153401.tar.bz2 samba-7644547a5523b77bd49d9a5d979d5e4939153401.zip |
s3:smbd: avoid string_set() in dir.c
And do some more error checks.
metze
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/dir.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source3/smbd/dir.c b/source3/smbd/dir.c index 322c2fe519..1d04e2bc5b 100644 --- a/source3/smbd/dir.c +++ b/source3/smbd/dir.c @@ -280,7 +280,7 @@ done: /* Lanman 2 specific code */ SAFE_FREE(dptr->wcard); - string_set(&dptr->path,""); + SAFE_FREE(dptr->path); SAFE_FREE(dptr); } @@ -563,7 +563,13 @@ NTSTATUS dptr_create(connection_struct *conn, files_struct *fsp, dptr->dnum += 1; /* Always bias the dnum by one - no zero dnums allowed. */ - string_set(&dptr->path,path); + dptr->path = SMB_STRDUP(path); + if (!dptr->path) { + bitmap_clear(sconn->searches.dptr_bmap, dptr->dnum - 1); + SAFE_FREE(dptr); + TALLOC_FREE(dir_hnd); + return NT_STATUS_NO_MEMORY; + } dptr->conn = conn; dptr->dir_hnd = dir_hnd; dptr->spid = spid; @@ -571,6 +577,7 @@ NTSTATUS dptr_create(connection_struct *conn, files_struct *fsp, dptr->wcard = SMB_STRDUP(wcard); if (!dptr->wcard) { bitmap_clear(sconn->searches.dptr_bmap, dptr->dnum - 1); + SAFE_FREE(dptr->path); SAFE_FREE(dptr); TALLOC_FREE(dir_hnd); return NT_STATUS_NO_MEMORY; |