]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Fix an error resource leak in OpenDir_from_pathref()
authorVolker Lendecke <vl@samba.org>
Thu, 10 Oct 2024 15:14:10 +0000 (17:14 +0200)
committerRalph Boehme <slow@samba.org>
Tue, 12 Nov 2024 13:26:10 +0000 (13:26 +0000)
We have to undo the fsp allocation and open we've done. Not noticed,
it's probably highly unlikely OpenDir_fsp() fails.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
Autobuild-User(master): Ralph Böhme <slow@samba.org>
Autobuild-Date(master): Tue Nov 12 13:26:10 UTC 2024 on atb-devel-224

source3/smbd/dir.c

index 64a747f294f267205a239d348c620d0667494eb0..3aaf070d5adb7a7a99ec9811b8a52549d23c9fee 100644 (file)
@@ -1077,6 +1077,8 @@ NTSTATUS OpenDir_from_pathref(TALLOC_CTX *mem_ctx,
 
        status = OpenDir_fsp(mem_ctx, fsp->conn, fsp, mask, attr, &dir_hnd);
        if (!NT_STATUS_IS_OK(status)) {
+               fd_close(fsp);
+               file_free(NULL, fsp);
                return status;
        }