git: dee055d1b1e6 - stable/14 - uipc_shm: Fix a free() of an uninitialized variable

From: Jake Freeland <jfree_at_FreeBSD.org>
Date: Sun, 12 May 2024 00:08:36 UTC
The branch stable/14 has been updated by jfree:

URL: https://cgit.FreeBSD.org/src/commit/?id=dee055d1b1e602da77016fd14cb003896586f864

commit dee055d1b1e602da77016fd14cb003896586f864
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-04-19 00:15:51 +0000
Commit:     Jake Freeland <jfree@FreeBSD.org>
CommitDate: 2024-05-11 23:57:44 +0000

    uipc_shm: Fix a free() of an uninitialized variable
    
    Reported by:    Coverity
    CID:            1544043
    Fixes:          b112232e4fb9 ("uipc_shm: Copyin userpath for ktrace(2)")
    
    (cherry picked from commit e411b2273603267dbc51c7839879e765b573c1c5)
---
 sys/kern/uipc_shm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sys/kern/uipc_shm.c b/sys/kern/uipc_shm.c
index 31c80913be84..0bfbc636e405 100644
--- a/sys/kern/uipc_shm.c
+++ b/sys/kern/uipc_shm.c
@@ -1214,6 +1214,8 @@ kern_shm_open2(struct thread *td, const char *userpath, int flags, mode_t mode,
 #endif
 
 		AUDIT_ARG_UPATH1_CANON(path);
+	} else {
+		path = NULL;
 	}
 
 	pdp = td->td_proc->p_pd;