From: Shachar Sharon Date: Tue, 3 Jun 2025 08:31:20 +0000 (+0300) Subject: smbd: Fix Coverity ID 1648344: print work-dir properly X-Git-Tag: tevent-0.17.0~28 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=686a39a2b04bbd0172960152cb09b9ce9e5c8e9f;p=thirdparty%2Fsamba.git smbd: Fix Coverity ID 1648344: print work-dir properly 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 Reviewed-by: Anoop C S Reviewed-by: Volker Lendecke Autobuild-User(master): Volker Lendecke Autobuild-Date(master): Fri Jun 13 09:55:09 UTC 2025 on atb-devel-224 --- diff --git a/source3/smbd/smb2_oplock.c b/source3/smbd/smb2_oplock.c index dcc0f13870a..5c2a1ae848f 100644 --- a/source3/smbd/smb2_oplock.c +++ b/source3/smbd/smb2_oplock.c @@ -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; }