Module Name:    src
Committed By:   maxv
Date:           Sat Aug 24 14:18:43 UTC 2019

Modified Files:
        src/sys/compat/linux/common: linux_socket.c

Log Message:
Fix memory leak.


To generate a diff of this commit:
cvs rdiff -u -r1.147 -r1.148 src/sys/compat/linux/common/linux_socket.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/compat/linux/common/linux_socket.c
diff -u src/sys/compat/linux/common/linux_socket.c:1.147 src/sys/compat/linux/common/linux_socket.c:1.148
--- src/sys/compat/linux/common/linux_socket.c:1.147	Sat Aug 24 14:08:35 2019
+++ src/sys/compat/linux/common/linux_socket.c	Sat Aug 24 14:18:43 2019
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_socket.c,v 1.147 2019/08/24 14:08:35 maxv Exp $	*/
+/*	$NetBSD: linux_socket.c,v 1.148 2019/08/24 14:18:43 maxv Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.147 2019/08/24 14:08:35 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_socket.c,v 1.148 2019/08/24 14:18:43 maxv Exp $");
 
 #if defined(_KERNEL_OPT)
 #include "opt_inet.h"
@@ -546,6 +546,8 @@ linux_sys_sendmsg(struct lwp *l, const s
 
 				case LINUX_SCM_CREDENTIALS:
 					/* no native equivalent, just drop it */
+					if (control != mtod(ctl_mbuf, void *))
+						free(control, M_MBUF);
 					m_free(ctl_mbuf);
 					ctl_mbuf = NULL;
 					msg.msg_control = NULL;

Reply via email to