Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/compat/linux/common Fix memory leak.



details:   https://anonhg.NetBSD.org/src/rev/9e6e58948d78
branches:  trunk
changeset: 459126:9e6e58948d78
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sat Aug 24 14:18:43 2019 +0000

description:
Fix memory leak.

diffstat:

 sys/compat/linux/common/linux_socket.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (27 lines):

diff -r 6032586996fc -r 9e6e58948d78 sys/compat/linux/common/linux_socket.c
--- a/sys/compat/linux/common/linux_socket.c    Sat Aug 24 14:08:35 2019 +0000
+++ b/sys/compat/linux/common/linux_socket.c    Sat Aug 24 14:18:43 2019 +0000
@@ -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 @@
 
                                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;



Home | Main Index | Thread Index | Old Index