Module Name:    src
Committed By:   dholland
Date:           Sat Mar 19 01:34:25 UTC 2011

Modified Files:
        src/sys/nfs: nfs_serv.c nfs_srvsubs.c

Log Message:
Fix memory leak introduced with the struct pathbuf changes. Hi, me.
Closes PR 44625.


To generate a diff of this commit:
cvs rdiff -u -r1.156 -r1.157 src/sys/nfs/nfs_serv.c
cvs rdiff -u -r1.8 -r1.9 src/sys/nfs/nfs_srvsubs.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_serv.c
diff -u src/sys/nfs/nfs_serv.c:1.156 src/sys/nfs/nfs_serv.c:1.157
--- src/sys/nfs/nfs_serv.c:1.156	Sat Feb  5 13:35:11 2011
+++ src/sys/nfs/nfs_serv.c	Sat Mar 19 01:34:24 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_serv.c,v 1.156 2011/02/05 13:35:11 yamt Exp $	*/
+/*	$NetBSD: nfs_serv.c,v 1.157 2011/03/19 01:34:24 dholland Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -55,7 +55,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.156 2011/02/05 13:35:11 yamt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.157 2011/03/19 01:34:24 dholland Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -463,6 +463,12 @@
 	}
 
 	if (error) {
+		if (nd.ni_pathbuf != NULL) {
+			pathbuf_destroy(nd.ni_pathbuf);
+		}
+		if (ipb != NULL) {
+			pathbuf_destroy(ipb);
+		}
 		nfsm_reply(NFSX_POSTOPATTR(v3));
 		nfsm_srvpostop_attr(dirattr_ret, &dirattr);
 		return (0);

Index: src/sys/nfs/nfs_srvsubs.c
diff -u src/sys/nfs/nfs_srvsubs.c:1.8 src/sys/nfs/nfs_srvsubs.c:1.9
--- src/sys/nfs/nfs_srvsubs.c:1.8	Tue Nov 30 10:30:03 2010
+++ src/sys/nfs/nfs_srvsubs.c	Sat Mar 19 01:34:24 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: nfs_srvsubs.c,v 1.8 2010/11/30 10:30:03 dholland Exp $	*/
+/*	$NetBSD: nfs_srvsubs.c,v 1.9 2011/03/19 01:34:24 dholland Exp $	*/
 
 /*
  * Copyright (c) 1989, 1993
@@ -70,7 +70,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: nfs_srvsubs.c,v 1.8 2010/11/30 10:30:03 dholland Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nfs_srvsubs.c,v 1.9 2011/03/19 01:34:24 dholland Exp $");
 
 #include <sys/param.h>
 #include <sys/proc.h>
@@ -276,6 +276,7 @@
 out:
 	if (ndp->ni_pathbuf != NULL) {
 		pathbuf_destroy(ndp->ni_pathbuf);
+		ndp->ni_pathbuf = NULL;
 	} else {
 		PNBUF_PUT(path);
 	}

Reply via email to