V4L/DVB (13025): s2250-board: Fix memory leaks
In some error cases, allocated buffers need to be freed before returning. Signed-off-by: Pete Eberlein <pete@sensoray.com> Signed-off-by: Douglas Schilling Landgraf <dougsland@redhat.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
parent
bb871652d9
commit
d66ddf2172
1 changed files with 8 additions and 2 deletions
|
@ -203,10 +203,13 @@ static int write_reg_fp(struct i2c_client *client, u16 addr, u16 val)
|
||||||
usb = go->hpi_context;
|
usb = go->hpi_context;
|
||||||
if (mutex_lock_interruptible(&usb->i2c_lock) != 0) {
|
if (mutex_lock_interruptible(&usb->i2c_lock) != 0) {
|
||||||
printk(KERN_INFO "i2c lock failed\n");
|
printk(KERN_INFO "i2c lock failed\n");
|
||||||
|
kfree(buf);
|
||||||
return -EINTR;
|
return -EINTR;
|
||||||
}
|
}
|
||||||
if (go7007_usb_vendor_request(go, 0x57, addr, val, buf, 16, 1) < 0)
|
if (go7007_usb_vendor_request(go, 0x57, addr, val, buf, 16, 1) < 0) {
|
||||||
|
kfree(buf);
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
mutex_unlock(&usb->i2c_lock);
|
mutex_unlock(&usb->i2c_lock);
|
||||||
if (buf[0] == 0) {
|
if (buf[0] == 0) {
|
||||||
|
@ -214,6 +217,7 @@ static int write_reg_fp(struct i2c_client *client, u16 addr, u16 val)
|
||||||
|
|
||||||
subaddr = (buf[4] << 8) + buf[5];
|
subaddr = (buf[4] << 8) + buf[5];
|
||||||
val_read = (buf[2] << 8) + buf[3];
|
val_read = (buf[2] << 8) + buf[3];
|
||||||
|
kfree(buf);
|
||||||
if (val_read != val) {
|
if (val_read != val) {
|
||||||
printk(KERN_INFO "invalid fp write %x %x\n",
|
printk(KERN_INFO "invalid fp write %x %x\n",
|
||||||
val_read, val);
|
val_read, val);
|
||||||
|
@ -224,8 +228,10 @@ static int write_reg_fp(struct i2c_client *client, u16 addr, u16 val)
|
||||||
subaddr, addr);
|
subaddr, addr);
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
|
kfree(buf);
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
}
|
||||||
|
|
||||||
/* save last 12b value */
|
/* save last 12b value */
|
||||||
if (addr == 0x12b)
|
if (addr == 0x12b)
|
||||||
|
|
Loading…
Reference in a new issue