Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/ufs/chfs Plug memory leaks in error returns in chfs_read...
details: https://anonhg.NetBSD.org/src/rev/e82e744f81ea
branches: trunk
changeset: 331947:e82e744f81ea
user: he <he%NetBSD.org@localhost>
date: Mon Sep 01 16:33:20 2014 +0000
description:
Plug memory leaks in error returns in chfs_readvnode().
diffstat:
sys/ufs/chfs/chfs_vnode.c | 7 +++++--
1 files changed, 5 insertions(+), 2 deletions(-)
diffs (25 lines):
diff -r 36539efed0e5 -r e82e744f81ea sys/ufs/chfs/chfs_vnode.c
--- a/sys/ufs/chfs/chfs_vnode.c Mon Sep 01 16:31:17 2014 +0000
+++ b/sys/ufs/chfs/chfs_vnode.c Mon Sep 01 16:33:20 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: chfs_vnode.c,v 1.10 2014/01/23 10:13:57 hannken Exp $ */
+/* $NetBSD: chfs_vnode.c,v 1.11 2014/09/01 16:33:20 he Exp $ */
/*-
* Copyright (c) 2010 Department of Software Engineering,
@@ -94,11 +94,14 @@
buf = kmem_alloc(len, KM_SLEEP);
err = chfs_read_leb(chmp, chvc->v->nref_lnr, buf,
CHFS_GET_OFS(chvc->v->nref_offset), len, &retlen);
- if (err)
+ if (err) {
+ kmem_free(buf, len);
return err;
+ }
if (retlen != len) {
chfs_err("Error reading vnode: read: %zu insted of: %zu\n",
len, retlen);
+ kmem_free(buf, len);
return EIO;
}
chfvn = (struct chfs_flash_vnode*)buf;
Home |
Main Index |
Thread Index |
Old Index