git: e9ea690ae848 - main - udp: Fix a memory leak in udp6_send()

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Tue, 14 Mar 2023 15:58:16 UTC
The branch main has been updated by markj:

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

commit e9ea690ae8486b74d6eeca62e316bf591d8aea4e
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2023-03-14 14:26:29 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2023-03-14 15:58:02 +0000

    udp: Fix a memory leak in udp6_send()
    
    Reviewed by:    glebius
    MFC after:      3 days
    Differential Revision:  https://reviews.freebsd.org/D38993
---
 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 8a95e1623f9c..c5f2cc452dfb 100644
--- a/sys/netinet6/udp6_usrreq.c
+++ b/sys/netinet6/udp6_usrreq.c
@@ -766,10 +766,10 @@ udp6_send(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);
 	}