git: e411b2273603 - main - uipc_shm: Fix a free() of an uninitialized variable

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Fri, 19 Apr 2024 00:18:54 UTC
The branch main has been updated by markj:

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

commit e411b2273603267dbc51c7839879e765b573c1c5
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-04-19 00:15:51 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-04-19 00:18:29 +0000

    uipc_shm: Fix a free() of an uninitialized variable
    
    Reported by:    Coverity
    CID:            1544043
    Fixes:          b112232e4fb9 ("uipc_shm: Copyin userpath for ktrace(2)")
---
 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 14fe43524935..1136f34a6f85 100644
--- a/sys/kern/uipc_shm.c
+++ b/sys/kern/uipc_shm.c
@@ -1215,6 +1215,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;