diff options
author | Nikita Kiryanov <nikita@compulab.co.il> | 2013-07-29 13:27:40 +0300 |
---|---|---|
committer | Marek Vasut <marex@denx.de> | 2013-07-29 23:01:33 +0200 |
commit | 8bc3603675f7bf4dfa4eb6bdaf2aa0a8ddce9fa6 (patch) | |
tree | a8817e9929b6d29ab2b0f2d5eabf8b10198b5336 /drivers/usb/host | |
parent | 0adc331b37b71093a047607faf1ed1b60e572017 (diff) | |
download | u-boot-imx-8bc3603675f7bf4dfa4eb6bdaf2aa0a8ddce9fa6.zip u-boot-imx-8bc3603675f7bf4dfa4eb6bdaf2aa0a8ddce9fa6.tar.gz u-boot-imx-8bc3603675f7bf4dfa4eb6bdaf2aa0a8ddce9fa6.tar.bz2 |
ehci-hcd: fix memory leak in lowlevel init
usb_lowlevel_init() allocates a new periodic_list each time it is invoked,
without freeing the original list. Since it is initialized later on in the code,
just reuse the first-allocated list in future invocations of usb_lowlevel_init.
Cc: Marek Vasut <marex@denx.de>
Cc: Igor Grinberg <grinberg@compulab.co.il>
Signed-off-by: Nikita Kiryanov <nikita@compulab.co.il>
Diffstat (limited to 'drivers/usb/host')
-rw-r--r-- | drivers/usb/host/ehci-hcd.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index 05d3f0b..fdad739 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c @@ -945,7 +945,9 @@ int usb_lowlevel_init(int index, void **controller) * Split Transactions will be spread across microframes using * S-mask and C-mask. */ - ehcic[index].periodic_list = memalign(4096, 1024*4); + if (ehcic[index].periodic_list == NULL) + ehcic[index].periodic_list = memalign(4096, 1024 * 4); + if (!ehcic[index].periodic_list) return -ENOMEM; for (i = 0; i < 1024; i++) { |