]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
smbd: Fix Coverity ID 1648344: print work-dir properly
authorShachar Sharon <ssharon@redhat.com>
Tue, 3 Jun 2025 08:31:20 +0000 (11:31 +0300)
committerVolker Lendecke <vl@samba.org>
Fri, 13 Jun 2025 09:55:09 +0000 (09:55 +0000)
Commit 509081e7e ("smbd: expand logging in contend_dirleases()") added a
log-trace which calls get_current_dir_name() on-the-fly, which caused a
Coverity issue (memory-leak). Replace this call with the proper call to
SMB_VFS_GETWD (+ release memory).

Fixes Coverity issue 1648344

Signed-off-by: Shachar Sharon <ssharon@redhat.com>
Reviewed-by: Anoop C S <anoopcs@samba.org>
Reviewed-by: Volker Lendecke <vl@samba.org>
Autobuild-User(master): Volker Lendecke <vl@samba.org>
Autobuild-Date(master): Fri Jun 13 09:55:09 UTC 2025 on atb-devel-224

source3/smbd/smb2_oplock.c

index dcc0f13870a93817cff3d141021ed550cc8e0e8c..5c2a1ae848f3e892d7d1035912bb20134b6cdcc3 100644 (file)
@@ -1336,14 +1336,17 @@ void contend_dirleases(struct connection_struct *conn,
 
        ret = SMB_VFS_STAT(conn, parent_fname);
        if (ret != 0) {
+               struct smb_filename *cwd = SMB_VFS_GETWD(conn, talloc_tos());
+
                DBG_ERR("Trigger [conn: %s] [smb_fname: %s] cwd [%s], "
                        "failed to stat parent [%s]: %s\n",
                        conn->connectpath,
                        smb_fname_str_dbg(smb_fname),
-                       get_current_dir_name(),
+                       (cwd != NULL) ? cwd->base_name : "",
                        smb_fname_str_dbg(parent_fname),
                        strerror(errno));
                TALLOC_FREE(parent_fname);
+               TALLOC_FREE(cwd);
                return;
        }