]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Move a variable declaration closer to its use
authorVolker Lendecke <vl@samba.org>
Wed, 17 Sep 2025 13:05:52 +0000 (06:05 -0700)
committerRalph Boehme <slow@samba.org>
Tue, 21 Oct 2025 17:33:29 +0000 (17:33 +0000)
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/smb2_nttrans.c

index 37d49f8289a2db9173de6c0ce65111a4fd653083..17eeb93fa366dc83af61aeb6bd6e4f49813645ea 100644 (file)
@@ -287,7 +287,6 @@ NTSTATUS copy_internals(TALLOC_CTX *ctx,
        off_t ret=-1;
        NTSTATUS status = NT_STATUS_OK;
        struct smb_filename *parent = NULL;
-       struct smb_filename *pathref = NULL;
 
        if (!CAN_WRITE(conn)) {
                status = NT_STATUS_MEDIA_WRITE_PROTECTED;
@@ -414,6 +413,8 @@ NTSTATUS copy_internals(TALLOC_CTX *ctx,
                goto out;
        }
        if (smb_fname_dst->fsp == NULL) {
+               struct smb_filename *pathref = NULL;
+
                status = synthetic_pathref(parent,
                                        conn->cwd_fsp,
                                        smb_fname_dst->base_name,
@@ -430,6 +431,7 @@ NTSTATUS copy_internals(TALLOC_CTX *ctx,
                }
                file_set_dosmode(conn, pathref, fattr, parent, false);
                smb_fname_dst->st.st_ex_mode = pathref->st.st_ex_mode;
+               TALLOC_FREE(pathref);
        } else {
                file_set_dosmode(conn, smb_fname_dst, fattr, parent, false);
        }