Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 7022cfdf authored by Sudip Mukherjee's avatar Sudip Mukherjee Committed by Felipe Balbi
Browse files

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: default avatarSudip Mukherjee <sudip@vectorindia.org>
Signed-off-by: default avatarFelipe Balbi <balbi@ti.com>
parent 9ffecb10
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -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;