Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/dm dm: Fix memory leak in dm_pdev_rem()
details: https://anonhg.NetBSD.org/src/rev/3a7deafcf4c2
branches: trunk
changeset: 1005564:3a7deafcf4c2
user: tkusumi <tkusumi%NetBSD.org@localhost>
date: Fri Dec 13 15:49:22 2019 +0000
description:
dm: Fix memory leak in dm_pdev_rem()
Need to free dmp regardless of dm_pdev_rem() return value.
taken-from: DragonFlyBSD
diffstat:
sys/dev/dm/dm_pdev.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diffs (30 lines):
diff -r c2b39b9ec950 -r 3a7deafcf4c2 sys/dev/dm/dm_pdev.c
--- a/sys/dev/dm/dm_pdev.c Fri Dec 13 14:13:55 2019 +0000
+++ b/sys/dev/dm/dm_pdev.c Fri Dec 13 15:49:22 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dm_pdev.c,v 1.19 2019/12/08 12:14:40 mlelstv Exp $ */
+/* $NetBSD: dm_pdev.c,v 1.20 2019/12/13 15:49:22 tkusumi Exp $ */
/*
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -29,7 +29,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dm_pdev.c,v 1.19 2019/12/08 12:14:40 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dm_pdev.c,v 1.20 2019/12/13 15:49:22 tkusumi Exp $");
#include <sys/types.h>
#include <sys/param.h>
@@ -174,8 +174,10 @@
if (dmp->pdev_vnode != NULL) {
int error = vn_close(dmp->pdev_vnode, FREAD | FWRITE, FSCRED);
- if (error != 0)
+ if (error != 0) {
+ kmem_free(dmp, sizeof(*dmp));
return error;
+ }
}
kmem_free(dmp, sizeof(*dmp));
Home |
Main Index |
Thread Index |
Old Index