git: 889dcb5e9b2f - stable/13 - OpenBSM: fix free() in au_read_rec error case

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Thu, 27 Oct 2022 00:24:45 UTC
The branch stable/13 has been updated by emaste:

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

commit 889dcb5e9b2ff4160c313b31cfa53106af2a5b0c
Author:     Ed Maste <emaste@FreeBSD.org>
AuthorDate: 2022-10-24 13:45:59 +0000
Commit:     Ed Maste <emaste@FreeBSD.org>
CommitDate: 2022-10-27 00:24:07 +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)
---
 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);
 		}