提交 8bc36036 编写于 作者: N Nikita Kiryanov 提交者: Marek Vasut

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: NNikita Kiryanov <nikita@compulab.co.il>
上级 0adc331b
......@@ -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++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册