summaryrefslogtreecommitdiff
path: root/drivers/media/usb/cx231xx/cx231xx-417.c
diff options
context:
space:
mode:
authorSudip Mukherjee <sudipm.mukherjee@gmail.com>2016-03-07 07:22:23 -0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2016-04-13 16:57:13 -0300
commit1254880834d08ad288b9706b5bd791dc11516e40 (patch)
tree150f07a8ea7f99fcd547365fe3e62df7778b6e0a /drivers/media/usb/cx231xx/cx231xx-417.c
parent54ace1cfd4358fd11112f17cc711eea234d5ab9e (diff)
[media] cx231xx: fix memory leak
When we returned on error we missed freeing p_current_fw and p_buffer. Signed-off-by: Sudip Mukherjee <sudip.mukherjee@codethink.co.uk> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
Diffstat (limited to 'drivers/media/usb/cx231xx/cx231xx-417.c')
-rw-r--r--drivers/media/usb/cx231xx/cx231xx-417.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/media/usb/cx231xx/cx231xx-417.c b/drivers/media/usb/cx231xx/cx231xx-417.c
index c9320d6c6131..3636d8d0abd3 100644
--- a/drivers/media/usb/cx231xx/cx231xx-417.c
+++ b/drivers/media/usb/cx231xx/cx231xx-417.c
@@ -966,6 +966,7 @@ static int cx231xx_load_firmware(struct cx231xx *dev)
p_buffer = vmalloc(4096);
if (p_buffer == NULL) {
dprintk(2, "FAIL!!!\n");
+ vfree(p_current_fw);
return -1;
}
@@ -989,6 +990,8 @@ static int cx231xx_load_firmware(struct cx231xx *dev)
if (retval != 0) {
dev_err(dev->dev,
"%s: Error with mc417_register_write\n", __func__);
+ vfree(p_current_fw);
+ vfree(p_buffer);
return -1;
}
@@ -1001,6 +1004,8 @@ static int cx231xx_load_firmware(struct cx231xx *dev)
CX231xx_FIRM_IMAGE_NAME);
dev_err(dev->dev,
"Please fix your hotplug setup, the board will not work without firmware loaded!\n");
+ vfree(p_current_fw);
+ vfree(p_buffer);
return -1;
}
@@ -1009,6 +1014,8 @@ static int cx231xx_load_firmware(struct cx231xx *dev)
"ERROR: Firmware size mismatch (have %zd, expected %d)\n",
firmware->size, CX231xx_FIRM_IMAGE_SIZE);
release_firmware(firmware);
+ vfree(p_current_fw);
+ vfree(p_buffer);
return -1;
}
@@ -1016,6 +1023,8 @@ static int cx231xx_load_firmware(struct cx231xx *dev)
dev_err(dev->dev,
"ERROR: Firmware magic mismatch, wrong file?\n");
release_firmware(firmware);
+ vfree(p_current_fw);
+ vfree(p_buffer);
return -1;
}