mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 13:55:32 +00:00
usb: gadget: bdc: fix memory leak
If dma_pool_alloc() fails we are jumping to fail and releasing all the bd_tables which have been added to the chain but we missed freeing this bd_table which was just allocated and still not added to the chain of bd_table. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Felipe Balbi <balbi@ti.com>
This commit is contained in:
parent
9ffecb1028
commit
7022cfdfe0
1 changed files with 3 additions and 1 deletions
|
@ -159,8 +159,10 @@ static int ep_bd_list_alloc(struct bdc_ep *ep)
|
|||
bd_table->start_bd = dma_pool_alloc(bdc->bd_table_pool,
|
||||
GFP_ATOMIC,
|
||||
&dma);
|
||||
if (!bd_table->start_bd)
|
||||
if (!bd_table->start_bd) {
|
||||
kfree(bd_table);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
bd_table->dma = dma;
|
||||
|
||||
|
|
Loading…
Reference in a new issue