git: 48767d8734ea - main - pfsync: fix memory leak

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Tue, 15 Nov 2022 11:14:04 UTC
The branch main has been updated by kp:

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

commit 48767d8734ea21182eec04273127818e3878c2e5
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2022-11-15 11:11:32 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2022-11-15 11:13:11 +0000

    pfsync: fix memory leak
    
    The recent refactoring to prepare for pfsync over IPv6 introduced a
    memory leak.
    If we don't have a sync peer configured we return early (without sending
    out a packet), but failed to free the newly allocated packet.
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 sys/netpfil/pf/if_pfsync.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/sys/netpfil/pf/if_pfsync.c b/sys/netpfil/pf/if_pfsync.c
index f8cca8a4460b..a2baf477873e 100644
--- a/sys/netpfil/pf/if_pfsync.c
+++ b/sys/netpfil/pf/if_pfsync.c
@@ -1589,6 +1589,7 @@ pfsync_sendout(int schedswi, int c)
 	    }
 #endif
 	default:
+		m_freem(m);
 		return;
 	}