git: 6728d270e132 - stable/13 - bhyve: Don't free an invalid pointer.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Fri, 11 Nov 2022 18:37:00 UTC
The branch stable/13 has been updated by jhb:

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

commit 6728d270e132846d9a45808d56f957a1b5c7a783
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-10-03 23:10:44 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-11-11 18:18:54 +0000

    bhyve: Don't free an invalid pointer.
    
    The netmap-specific data stored at be->opaque is freed by the caller
    on error as part of freeing be.
    
    Reviewed by:    markj
    Reported by:    GCC -Wfree-nonheap-object
    Differential Revision:  https://reviews.freebsd.org/D36828
    
    (cherry picked from commit 2fb81691b02f27fa938f311835a8c6704c5cf80f)
---
 usr.sbin/bhyve/net_backends.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/usr.sbin/bhyve/net_backends.c b/usr.sbin/bhyve/net_backends.c
index 16a3d831aaa3..5b4a2c0ae257 100644
--- a/usr.sbin/bhyve/net_backends.c
+++ b/usr.sbin/bhyve/net_backends.c
@@ -695,7 +695,6 @@ netmap_init(struct net_backend *be, const char *devname,
 	if (priv->nmd == NULL) {
 		WPRINTF(("Unable to nm_open(): interface '%s', errno (%s)",
 			devname, strerror(errno)));
-		free(priv);
 		return (-1);
 	}