Source-Changes-HG archive

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

[src/trunk]: src/sys/net Fix ipsecif(4) memory leak in some ioctl cases.



details:   https://anonhg.NetBSD.org/src/rev/2f69b06362b5
branches:  trunk
changeset: 997581:2f69b06362b5
user:      knakahara <knakahara%NetBSD.org@localhost>
date:      Thu Mar 14 03:52:40 2019 +0000

description:
Fix ipsecif(4) memory leak in some ioctl cases.

diffstat:

 sys/net/if_ipsec.c |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (35 lines):

diff -r 5000f8cec59b -r 2f69b06362b5 sys/net/if_ipsec.c
--- a/sys/net/if_ipsec.c        Thu Mar 14 00:36:06 2019 +0000
+++ b/sys/net/if_ipsec.c        Thu Mar 14 03:52:40 2019 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: if_ipsec.c,v 1.20 2018/12/26 08:55:14 knakahara Exp $  */
+/*     $NetBSD: if_ipsec.c,v 1.21 2019/03/14 03:52:40 knakahara Exp $  */
 
 /*
  * Copyright (c) 2017 Internet Initiative Japan Inc.
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.20 2018/12/26 08:55:14 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_ipsec.c,v 1.21 2019/03/14 03:52:40 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -1105,6 +1105,7 @@
                mutex_exit(&sc->ipsec_lock);
                encap_lock_exit();
                kmem_free(nvar, sizeof(*nvar));
+               kmem_free(nullvar, sizeof(*nullvar));
                return;
        }
 
@@ -1192,6 +1193,8 @@
                /* nothing to do */
                mutex_exit(&sc->ipsec_lock);
                encap_lock_exit();
+               kmem_free(nvar, sizeof(*nvar));
+               kmem_free(nullvar, sizeof(*nullvar));
                return 0;
        }
 



Home | Main Index | Thread Index | Old Index