summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/smbd/dir.c11
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;