Module Name:    src
Committed By:   maxv
Date:           Sun Nov 20 09:28:43 UTC 2016

Modified Files:
        src/sys/nfs: nfs_export.c

Log Message:
Memory leak, found by Mootja.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/nfs/nfs_export.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/nfs/nfs_export.c
diff -u src/sys/nfs/nfs_export.c:1.58 src/sys/nfs/nfs_export.c:1.59
--- src/sys/nfs/nfs_export.c:1.58	Sat Dec 14 16:19:28 2013
+++ src/sys/nfs/nfs_export.c	Sun Nov 20 09:28:43 2016
@@ -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 @@ hang_addrlist(struct mount *mp, struct n
 		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 @@ hang_addrlist(struct mount *mp, struct n
 			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) {

Reply via email to