Source-Changes-HG archive

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

[src/trunk]: src/sys/netinet Fix memory leak, found by Mootja.



details:   https://anonhg.NetBSD.org/src/rev/c6859a786422
branches:  trunk
changeset: 829005:c6859a786422
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun Jan 14 16:18:11 2018 +0000

description:
Fix memory leak, found by Mootja.

diffstat:

 sys/netinet/ip_encap.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (36 lines):

diff -r 380ea6280470 -r c6859a786422 sys/netinet/ip_encap.c
--- a/sys/netinet/ip_encap.c    Sun Jan 14 11:55:33 2018 +0000
+++ b/sys/netinet/ip_encap.c    Sun Jan 14 16:18:11 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ip_encap.c,v 1.66 2017/11/15 10:42:41 knakahara Exp $  */
+/*     $NetBSD: ip_encap.c,v 1.67 2018/01/14 16:18:11 maxv Exp $       */
 /*     $KAME: ip_encap.c,v 1.73 2001/10/02 08:30:58 itojun Exp $       */
 
 /*
@@ -68,7 +68,7 @@
 #define USE_RADIX
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v 1.66 2017/11/15 10:42:41 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ip_encap.c,v 1.67 2018/01/14 16:18:11 maxv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_mrouting.h"
@@ -822,7 +822,7 @@
 
        error = encap_add(ep);
        if (error)
-               goto fail;
+               goto gc;
 
        error = 0;
 #ifndef ENCAP_MPSAFE
@@ -830,6 +830,8 @@
 #endif
        return ep;
 
+gc:
+       kmem_free(ep, sizeof(*ep));
 fail:
 #ifndef ENCAP_MPSAFE
        splx(s);



Home | Main Index | Thread Index | Old Index