diff options
author | Roberto Alcântara <roberto@eletronica.org> | 2013-05-21 16:32:30 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2013-06-13 09:00:45 -0300 |
commit | 36b51146539c42306fd6ab1ff30cfc5a2d13c706 (patch) | |
tree | f61f61e71aa3979c73e6a927c65fda6bd180a9c6 /drivers/media/common | |
parent | 62d54876c511628daed2246753e2fe348da022f1 (diff) | |
download | op-kernel-dev-36b51146539c42306fd6ab1ff30cfc5a2d13c706.zip op-kernel-dev-36b51146539c42306fd6ab1ff30cfc5a2d13c706.tar.gz |
[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 dbe9b4d..a142f79 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); |