Fix memory leak introduced with the struct pathbuf changes. Hi, me.

Closes PR 44625.
This commit is contained in:
dholland 2011-03-19 01:34:24 +00:00
parent d85d9a6541
commit 4a414f41ec
2 changed files with 11 additions and 4 deletions

View File

@ -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 @@ nfsrv_lookup(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, struct lwp *l
}
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);

View File

@ -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 @@ nfs_namei(struct nameidata *ndp, nfsrvfh_t *nsfh, uint32_t len, struct nfssvc_so
out:
if (ndp->ni_pathbuf != NULL) {
pathbuf_destroy(ndp->ni_pathbuf);
ndp->ni_pathbuf = NULL;
} else {
PNBUF_PUT(path);
}