Source-Changes-HG archive

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

[src/trunk]: src/sys/nfs Memory leak, found by Mootja.



details:   https://anonhg.NetBSD.org/src/rev/e0fadac4fcbf
branches:  trunk
changeset: 349009:e0fadac4fcbf
user:      maxv <maxv%NetBSD.org@localhost>
date:      Sun Nov 20 09:28:43 2016 +0000

description:
Memory leak, found by Mootja.

diffstat:

 sys/nfs/nfs_export.c |  22 ++++++++++++++--------
 1 files changed, 14 insertions(+), 8 deletions(-)

diffs (50 lines):

diff -r 2e83f36cd8b5 -r e0fadac4fcbf sys/nfs/nfs_export.c
--- a/sys/nfs/nfs_export.c      Sun Nov 20 07:05:20 2016 +0000
+++ b/sys/nfs/nfs_export.c      Sun Nov 20 09:28:43 2016 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: nfs_export.c,v 1.58 2013/12/14 16:19:28 christos Exp $ */
+/*     $NetBSD: nfs_export.c,v 1.59 2016/11/20 09:28:43 maxv Exp $     */
 
 /*-
  * Copyright (c) 1997, 1998, 2004, 2005, 2008 The NetBSD Foundation, Inc.
@@ -77,7 +77,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_export.c,v 1.58 2013/12/14 16:19:28 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_export.c,v 1.59 2016/11/20 09:28:43 maxv Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -541,8 +541,10 @@
                goto out;
        if (saddr->sa_len > argp->ex_addrlen)
                saddr->sa_len = argp->ex_addrlen;
-       if (sacheck(saddr) == -1)
-               return EINVAL;
+       if (sacheck(saddr) == -1) {
+               error = EINVAL;
+               goto out;
+       }
        if (argp->ex_masklen) {
                smask = (struct sockaddr *)((char *)saddr + argp->ex_addrlen);
                error = copyin(argp->ex_mask, smask, argp->ex_masklen);
@@ -550,10 +552,14 @@
                        goto out;
                if (smask->sa_len > argp->ex_masklen)
                        smask->sa_len = argp->ex_masklen;
-               if (smask->sa_family != saddr->sa_family)
-                       return EINVAL;
-               if (sacheck(smask) == -1)
-                       return EINVAL;
+               if (smask->sa_family != saddr->sa_family) {
+                       error = EINVAL;
+                       goto out;
+               }
+               if (sacheck(smask) == -1) {
+                       error = EINVAL;
+                       goto out;
+               }
        }
        i = saddr->sa_family;
        if ((rnh = nep->ne_rtable[i]) == 0) {



Home | Main Index | Thread Index | Old Index