[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:
Roberto Alcântara 2013-05-21 16:32:30 -03:00 committed by Mauro Carvalho Chehab
parent 62d54876c5
commit 36b5114653
1 changed files with 9 additions and 8 deletions

View File

@ -1173,8 +1173,8 @@ 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;
}
rc = -ENOMEM;
} else {
memcpy(fw_buf, fw->data, fw->size);
fw_buf_size = fw->size;
@ -1182,6 +1182,7 @@ static int smscore_load_firmware_from_file(struct smscore_device_t *coredev,
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);