git: a16d3089b295 - stable/13 - udp: Fix a memory leak in udp6_send()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Mon, 20 Mar 2023 13:33:43 UTC
The branch stable/13 has been updated by markj:

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

commit a16d3089b2951c3c13979fd79313bb6c7b652445
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-03-14 14:26:29 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-03-20 12:52:07 +0000

    udp: Fix a memory leak in udp6_send()
    
    Reviewed by:    glebius
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D38993
    
    (cherry picked from commit e9ea690ae8486b74d6eeca62e316bf591d8aea4e)
---
 sys/netinet6/udp6_usrreq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c
index ff7227cb99f3..6c40a8cae2d5 100644
--- a/sys/netinet6/udp6_usrreq.c
+++ b/sys/netinet6/udp6_usrreq.c
@@ -803,10 +803,10 @@ udp6_output(struct socket *so, int flags_arg, struct mbuf *m,
 		 * Given this is either an IPv6-only socket or no INET is
 		 * supported we will fail the send if the given destination
 		 * address is a v4mapped address.
-		 *
-		 * XXXGL: do we leak m and control?
 		 */
 		INP_UNLOCK(inp);
+		m_freem(m);
+		m_freem(control);
 		return (EINVAL);
 	}