nfs_mount: Plug a possible leaks.

Invented in 1.114 rev.
From CID: 4534
This commit is contained in:
rmind 2007-09-06 01:11:44 +00:00
parent 8fe0ea8b87
commit 27ad3d8619
1 changed files with 5 additions and 5 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: nfs_vfsops.c,v 1.184 2007/08/10 15:12:56 yamt Exp $ */
/* $NetBSD: nfs_vfsops.c,v 1.185 2007/09/06 01:11:44 rmind Exp $ */
/*
* Copyright (c) 1989, 1993, 1995
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.184 2007/08/10 15:12:56 yamt Exp $");
__KERNEL_RCSID(0, "$NetBSD: nfs_vfsops.c,v 1.185 2007/09/06 01:11:44 rmind Exp $");
#if defined(_KERNEL_OPT)
#include "opt_compat_netbsd.h"
@ -653,16 +653,16 @@ nfs_mount(struct mount *mp, const char *path, void *data, size_t *data_len,
MALLOC(nfh, u_char *, NFSX_V3FHMAX, M_TEMP, M_WAITOK);
error = copyin(args->fh, nfh, args->fhsize);
if (error)
return (error);
goto free_nfh;
MALLOC(pth, char *, MNAMELEN, M_TEMP, M_WAITOK);
error = copyinstr(path, pth, MNAMELEN - 1, &len);
if (error)
goto free_nfh;
goto free_pth;
memset(&pth[len], 0, MNAMELEN - len);
MALLOC(hst, char *, MNAMELEN, M_TEMP, M_WAITOK);
error = copyinstr(args->hostname, hst, MNAMELEN - 1, &len);
if (error)
goto free_pth;
goto free_hst;
memset(&hst[len], 0, MNAMELEN - len);
/* sockargs() call must be after above copyin() calls */
error = sockargs(&nam, args->addr, args->addrlen, MT_SONAME);