From: Volker Lendecke Date: Fri, 5 Nov 2021 10:51:33 +0000 (+0100) Subject: lib: Slightly tune cp_smb_filename_nostream() X-Git-Tag: ldb-2.5.0~69 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=05c41a02dd6dee3e29b44b69ac3dd6f60d87b475;p=thirdparty%2Fsamba.git lib: Slightly tune cp_smb_filename_nostream() Don't talloc_strdup() the stream_name, just to free it again. Signed-off-by: Volker Lendecke Reviewed-by: Jeremy Allison --- diff --git a/source3/lib/filename_util.c b/source3/lib/filename_util.c index 120d2ecc4bc..f97c4310162 100644 --- a/source3/lib/filename_util.c +++ b/source3/lib/filename_util.c @@ -80,12 +80,12 @@ struct smb_filename *synthetic_smb_fname(TALLOC_CTX *mem_ctx, struct smb_filename *cp_smb_filename_nostream(TALLOC_CTX *mem_ctx, const struct smb_filename *smb_fname_in) { - struct smb_filename *smb_fname = cp_smb_filename(mem_ctx, - smb_fname_in); - if (smb_fname == NULL) { - return NULL; - } - TALLOC_FREE(smb_fname->stream_name); + struct smb_filename smb_fname_loc = *smb_fname_in; + struct smb_filename *smb_fname = NULL; + + smb_fname_loc.stream_name = NULL; + + smb_fname = cp_smb_filename(mem_ctx, &smb_fname_loc); return smb_fname; }