]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
s3: smbd: In smbd_dirptr_get_entry(), postpone TALLOC_FREE(atname) as we're going...
authorJeremy Allison <jra@samba.org>
Mon, 12 Jul 2021 23:32:23 +0000 (16:32 -0700)
committerRalph Boehme <slow@samba.org>
Wed, 14 Jul 2021 08:09:31 +0000 (08:09 +0000)
Signed-off-by: Jeremy Allison <jra@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/dir.c

index 20fee6dc3e8d4d18832af147ff35b9995f8a8ddd..9d8ad01f3b0d59a8032865915e6176452ab68c26 100644 (file)
@@ -925,11 +925,11 @@ bool smbd_dirptr_get_entry(TALLOC_CTX *ctx,
                }
 
                status = move_smb_fname_fsp_link(smb_fname, atname);
-               TALLOC_FREE(atname);
                if (!NT_STATUS_IS_OK(status)) {
                        DBG_WARNING("Failed to move pathref for [%s]: %s\n",
                                    smb_fname_str_dbg(smb_fname),
                                    nt_errstr(status));
+                       TALLOC_FREE(atname);
                        TALLOC_FREE(smb_fname);
                        TALLOC_FREE(dname);
                        TALLOC_FREE(fname);
@@ -937,6 +937,7 @@ bool smbd_dirptr_get_entry(TALLOC_CTX *ctx,
                }
 
                if (!is_visible_fsp(smb_fname->fsp)) {
+                       TALLOC_FREE(atname);
                        TALLOC_FREE(smb_fname);
                        TALLOC_FREE(dname);
                        TALLOC_FREE(fname);
@@ -945,12 +946,15 @@ bool smbd_dirptr_get_entry(TALLOC_CTX *ctx,
 
                ok = mode_fn(ctx, private_data, smb_fname, get_dosmode, &mode);
                if (!ok) {
+                       TALLOC_FREE(atname);
                        TALLOC_FREE(smb_fname);
                        TALLOC_FREE(dname);
                        TALLOC_FREE(fname);
                        continue;
                }
 
+               TALLOC_FREE(atname);
+
                /*
                 * The only valid cases where we return the directory entry if
                 * it's a symlink are: