diff options
author | Roberto Alcântara <roberto@eletronica.org> | 2013-05-21 21:32:30 +0200 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-06-13 14:00:45 +0200 |
commit | 36b51146539c42306fd6ab1ff30cfc5a2d13c706 (patch) | |
tree | f61f61e71aa3979c73e6a927c65fda6bd180a9c6 /drivers/media/common | |
parent | [media] s5p-tv: Don't ignore return value of regulator_bulk_enable() in hdmi_... (diff) | |
download | linux-36b51146539c42306fd6ab1ff30cfc5a2d13c706.tar.xz linux-36b51146539c42306fd6ab1ff30cfc5a2d13c706.zip |
[media] smscoreapi: memory leak fix
Ensure release_firmware is called if kmalloc fails.
[mchehab@redhat.com: patch unmangled and converted from -p2 to -p1]
Signed-off-by: Roberto Alcantara <roberto@eletronica.org>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/common')
-rw-r--r-- | drivers/media/common/siano/smscoreapi.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/media/common/siano/smscoreapi.c b/drivers/media/common/siano/smscoreapi.c index dbe9b4d9b799..a142f7942a01 100644 --- a/drivers/media/common/siano/smscoreapi.c +++ b/drivers/media/common/siano/smscoreapi.c @@ -1173,15 +1173,16 @@ static int smscore_load_firmware_from_file(struct smscore_device_t *coredev, GFP_KERNEL | GFP_DMA); if (!fw_buf) { sms_err("failed to allocate firmware buffer"); - return -ENOMEM; - } - memcpy(fw_buf, fw->data, fw->size); - fw_buf_size = fw->size; + rc = -ENOMEM; + } else { + memcpy(fw_buf, fw->data, fw->size); + fw_buf_size = fw->size; - rc = (coredev->device_flags & SMS_DEVICE_FAMILY2) ? - smscore_load_firmware_family2(coredev, fw_buf, fw_buf_size) - : loadfirmware_handler(coredev->context, fw_buf, - fw_buf_size); + rc = (coredev->device_flags & SMS_DEVICE_FAMILY2) ? + smscore_load_firmware_family2(coredev, fw_buf, fw_buf_size) + : loadfirmware_handler(coredev->context, fw_buf, + fw_buf_size); + } kfree(fw_buf); release_firmware(fw); |