git: c61b3f7de9a0 - main - OpenBSM: fix free() in au_read_rec error case

From: Ed Maste <emaste_at_FreeBSD.org>
Date: Mon, 24 Oct 2022 13:49:52 UTC
The branch main has been updated by emaste:

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

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