git: 990aa6476eec - releng/12.4 - OpenBSM: fix free() in au_read_rec error case

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Mon, 31 Oct 2022 17:18:19 UTC
The branch releng/12.4 has been updated by emaste:

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

commit 990aa6476eec17339c170ac12f75fc253e8ec4c8
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2022-10-24 13:45:59 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2022-10-31 17:16:28 +0000

    OpenBSM: fix free() in au_read_rec error case
    
    buf is a char ** and *buf is the allocated buffer.
    
    PR:             267050
    Reported by:    Robert Morris <rtm@lcs.mit.edu>
    MFC after:      3 days
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit c61b3f7de9a0a39d2bc78e3e78d148c369e706a5)
    (cherry picked from commit 889dcb5e9b2ff4160c313b31cfa53106af2a5b0c)
    (cherry picked from commit 2b25564af6f9d1303fb92b8dfd3a36f5d7fc3c34)
    
    Approved by:    re (gjb)
---
 contrib/openbsm/libbsm/bsm_io.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/openbsm/libbsm/bsm_io.c b/contrib/openbsm/libbsm/bsm_io.c
index 43cf7e9990c1..4b89ccb8b59c 100644
--- a/contrib/openbsm/libbsm/bsm_io.c
+++ b/contrib/openbsm/libbsm/bsm_io.c
@@ -4597,7 +4597,7 @@ au_read_rec(FILE *fp, u_char **buf)
 
 		if (fread(bptr, 1, ntohs(filenamelen), fp) <
 		    ntohs(filenamelen)) {
-			free(buf);
+			free(*buf);
 			errno = EINVAL;
 			return (-1);
 		}