mirror of https://gitee.com/openkylin/linux.git
[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>
This commit is contained in:
parent
62d54876c5
commit
36b5114653
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue