Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/dev/usb Fix memory leaks. Was wondering where memory had...
details: https://anonhg.NetBSD.org/src/rev/fb3f32295f5c
branches: trunk
changeset: 464331:fb3f32295f5c
user: maxv <maxv%NetBSD.org@localhost>
date: Thu Oct 03 05:20:31 2019 +0000
description:
Fix memory leaks. Was wondering where memory had gone after several hours
of attach/detach with vHCI.
diffstat:
sys/dev/usb/usb_subr.c | 13 +++++++++++--
1 files changed, 11 insertions(+), 2 deletions(-)
diffs (34 lines):
diff -r 49fbccf2d902 -r fb3f32295f5c sys/dev/usb/usb_subr.c
--- a/sys/dev/usb/usb_subr.c Thu Oct 03 05:16:16 2019 +0000
+++ b/sys/dev/usb/usb_subr.c Thu Oct 03 05:20:31 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: usb_subr.c,v 1.240 2019/09/15 09:24:38 maxv Exp $ */
+/* $NetBSD: usb_subr.c,v 1.241 2019/10/03 05:20:31 maxv Exp $ */
/* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */
/*
@@ -32,7 +32,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.240 2019/09/15 09:24:38 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.241 2019/10/03 05:20:31 maxv Exp $");
#ifdef _KERNEL_OPT
#include "opt_compat_netbsd.h"
@@ -1479,6 +1479,15 @@
up->up_dev = NULL;
dev->ud_bus->ub_devices[usb_addr2dindex(dev->ud_addr)] = NULL;
+ if (dev->ud_vendor != NULL) {
+ kmem_free(dev->ud_vendor, USB_MAX_ENCODED_STRING_LEN);
+ }
+ if (dev->ud_product != NULL) {
+ kmem_free(dev->ud_product, USB_MAX_ENCODED_STRING_LEN);
+ }
+ if (dev->ud_serial != NULL) {
+ kmem_free(dev->ud_serial, USB_MAX_ENCODED_STRING_LEN);
+ }
kmem_free(dev, sizeof(*dev));
}
Home |
Main Index |
Thread Index |
Old Index