Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/miscfs/kernfs Don't leak memory in VFS_MOUNT() if set_st...
details: https://anonhg.NetBSD.org/src/rev/364a8bb113ab
branches: trunk
changeset: 567048:364a8bb113ab
user: tron <tron%NetBSD.org@localhost>
date: Sat May 29 14:28:41 2004 +0000
description:
Don't leak memory in VFS_MOUNT() if set_statvfs_info() fails.
diffstat:
sys/miscfs/kernfs/kernfs_vfsops.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diffs (45 lines):
diff -r 7e4f37f41955 -r 364a8bb113ab sys/miscfs/kernfs/kernfs_vfsops.c
--- a/sys/miscfs/kernfs/kernfs_vfsops.c Sat May 29 14:18:33 2004 +0000
+++ b/sys/miscfs/kernfs/kernfs_vfsops.c Sat May 29 14:28:41 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: kernfs_vfsops.c,v 1.63 2004/05/25 14:54:57 hannken Exp $ */
+/* $NetBSD: kernfs_vfsops.c,v 1.64 2004/05/29 14:28:41 tron Exp $ */
/*
* Copyright (c) 1992, 1993, 1995
@@ -39,7 +39,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: kernfs_vfsops.c,v 1.63 2004/05/25 14:54:57 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kernfs_vfsops.c,v 1.64 2004/05/29 14:28:41 tron Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -162,11 +162,14 @@
mp->mnt_flag |= MNT_LOCAL;
vfs_getnewfsid(mp);
- error = set_statvfs_info(path, UIO_USERSPACE, "kernfs", UIO_SYSSPACE,
- mp, p);
+ if ((error = set_statvfs_info(path, UIO_USERSPACE, "kernfs",
+ UIO_SYSSPACE, mp, p)) != 0) {
+ free(fmp, M_KERNFSMNT);
+ return error;
+ }
kernfs_get_rrootdev();
- return error;
+ return 0;
}
int
@@ -198,7 +201,7 @@
* Finally, throw away the kernfs_mount structure
*/
free(mp->mnt_data, M_KERNFSMNT);
- mp->mnt_data = 0;
+ mp->mnt_data = NULL;
return (0);
}
Home |
Main Index |
Thread Index |
Old Index