vfs_fruit: fix use after free in delete_invalid_meta_stream()
authorRalph Boehme <slow@samba.org>
Thu, 21 Jan 2021 13:36:59 +0000 (14:36 +0100)
committerJeremy Allison <jra@samba.org>
Thu, 28 Jan 2021 08:11:49 +0000 (08:11 +0000)
sname is used in the DBG_ERR message.

Signed-off-by: Ralph Boehme <slow@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
source3/modules/vfs_fruit.c

index 9250baee1b6ec6c72ea36f9af9422fd7c7997d19..7c7c3cd036f6f4e226a719c878ca3820f40b29bf 100644 (file)
@@ -3491,12 +3491,13 @@ static NTSTATUS delete_invalid_meta_stream(
                        handle->conn->cwd_fsp,
                        sname,
                        0);
-       TALLOC_FREE(sname);
        if (ret != 0) {
                DBG_ERR("Removing [%s] failed\n", smb_fname_str_dbg(sname));
+               TALLOC_FREE(sname);
                return map_nt_error_from_unix(errno);
        }
 
+       TALLOC_FREE(sname);
        return NT_STATUS_OK;
 }