summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2022-09-09 13:43:54 +0200
committerJeremy Allison <jra@samba.org>2022-09-19 17:23:31 +0000
commite4d8dc7943b33f749b18f2c55738a6cfad2c8e55 (patch)
tree5ba85a9221c473c052fd8a30d8261aa014faf20f
parent68d20326db8a2bf6296e6efc5f2ab831db3a1521 (diff)
downloadsamba-e4d8dc7943b33f749b18f2c55738a6cfad2c8e55.tar.gz
vfs: Avoid a talloc in vfswrap_parent_pathname()
We copy smb_fname_in->base_name just to overwrite it again immediately. Expand synthetic_smb_fname() here. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r--source3/modules/vfs_default.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/source3/modules/vfs_default.c b/source3/modules/vfs_default.c
index 6cad87152ef..63c44f27a57 100644
--- a/source3/modules/vfs_default.c
+++ b/source3/modules/vfs_default.c
@@ -1454,18 +1454,17 @@ static NTSTATUS vfswrap_parent_pathname(struct vfs_handle_struct *handle,
return NT_STATUS_OK;
}
- name = cp_smb_filename(frame, smb_fname_in);
+ name = synthetic_smb_fname(
+ frame,
+ p,
+ smb_fname_in->stream_name,
+ &smb_fname_in->st,
+ smb_fname_in->twrp,
+ smb_fname_in->flags);
if (name == NULL) {
TALLOC_FREE(frame);
return NT_STATUS_NO_MEMORY;
}
- TALLOC_FREE(name->base_name);
-
- name->base_name = talloc_strdup(name, p);
- if (name->base_name == NULL) {
- TALLOC_FREE(frame);
- return NT_STATUS_NO_MEMORY;
- }
*parent_dir_out = talloc_move(mem_ctx, &parent);
*atname_out = talloc_move(*parent_dir_out, &name);