aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorPete Eberlein <pete@sensoray.com>2009-09-18 21:05:19 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2009-09-18 23:54:04 -0400
commitd66ddf21723146a69915a0cf46db77f409e74602 (patch)
treea57fc6f0b81f268b1a50b4d7292c702506e5aba2 /drivers
parentbb871652d9523d5be811c0c36b04c05c4ac37f92 (diff)
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>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/staging/go7007/s2250-board.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/staging/go7007/s2250-board.c b/drivers/staging/go7007/s2250-board.c
index f35f0776c2fe..3310961de1ec 100644
--- a/drivers/staging/go7007/s2250-board.c
+++ b/drivers/staging/go7007/s2250-board.c
@@ -203,10 +203,13 @@ static int write_reg_fp(struct i2c_client *client, u16 addr, u16 val)
203 usb = go->hpi_context; 203 usb = go->hpi_context;
204 if (mutex_lock_interruptible(&usb->i2c_lock) != 0) { 204 if (mutex_lock_interruptible(&usb->i2c_lock) != 0) {
205 printk(KERN_INFO "i2c lock failed\n"); 205 printk(KERN_INFO "i2c lock failed\n");
206 kfree(buf);
206 return -EINTR; 207 return -EINTR;
207 } 208 }
208 if (go7007_usb_vendor_request(go, 0x57, addr, val, buf, 16, 1) < 0) 209 if (go7007_usb_vendor_request(go, 0x57, addr, val, buf, 16, 1) < 0) {
210 kfree(buf);
209 return -EFAULT; 211 return -EFAULT;
212 }
210 213
211 mutex_unlock(&usb->i2c_lock); 214 mutex_unlock(&usb->i2c_lock);
212 if (buf[0] == 0) { 215 if (buf[0] == 0) {
@@ -214,6 +217,7 @@ static int write_reg_fp(struct i2c_client *client, u16 addr, u16 val)
214 217
215 subaddr = (buf[4] << 8) + buf[5]; 218 subaddr = (buf[4] << 8) + buf[5];
216 val_read = (buf[2] << 8) + buf[3]; 219 val_read = (buf[2] << 8) + buf[3];
220 kfree(buf);
217 if (val_read != val) { 221 if (val_read != val) {
218 printk(KERN_INFO "invalid fp write %x %x\n", 222 printk(KERN_INFO "invalid fp write %x %x\n",
219 val_read, val); 223 val_read, val);
@@ -224,8 +228,10 @@ static int write_reg_fp(struct i2c_client *client, u16 addr, u16 val)
224 subaddr, addr); 228 subaddr, addr);
225 return -EFAULT; 229 return -EFAULT;
226 } 230 }
227 } else 231 } else {
232 kfree(buf);
228 return -EFAULT; 233 return -EFAULT;
234 }
229 235
230 /* save last 12b value */ 236 /* save last 12b value */
231 if (addr == 0x12b) 237 if (addr == 0x12b)