Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cx82310_eth: fix a memory leak bug

In cx82310_bind(), 'dev->partial_data' is allocated through kmalloc().
Then, the execution waits for the firmware to become ready. If the firmware
is not ready in time, the execution is terminated. However, the allocated
'dev->partial_data' is not deallocated on this path, leading to a memory
leak bug. To fix this issue, free 'dev->partial_data' before returning the
error.

Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Wenwen Wang and committed by
David S. Miller
1eca92ee 4a4d2d37

+2 -1
+2 -1
drivers/net/usb/cx82310_eth.c
··· 163 163 } 164 164 if (!timeout) { 165 165 dev_err(&udev->dev, "firmware not ready in time\n"); 166 - return -ETIMEDOUT; 166 + ret = -ETIMEDOUT; 167 + goto err; 167 168 } 168 169 169 170 /* enable ethernet mode (?) */