In some error cases, allocated buffers need to be freed before returning.

Priority: normal

Signed-off-by: Pete Eberlein <[email protected]>

diff -r e227a099a9f2 -r bf8ee230f1a0 linux/drivers/staging/go7007/s2250-board.c
--- a/linux/drivers/staging/go7007/s2250-board.c        Fri Sep 18 10:37:01 
2009 -0700
+++ b/linux/drivers/staging/go7007/s2250-board.c        Fri Sep 18 10:39:03 
2009 -0700
@@ -203,10 +203,13 @@
        usb = go->hpi_context;
        if (mutex_lock_interruptible(&usb->i2c_lock) != 0) {
                printk(KERN_INFO "i2c lock failed\n");
+               kfree(buf);
                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;
+       }
 
        mutex_unlock(&usb->i2c_lock);
        if (buf[0] == 0) {
@@ -214,6 +217,7 @@
 
                subaddr = (buf[4] << 8) + buf[5];
                val_read = (buf[2] << 8) + buf[3];
+               kfree(buf);
                if (val_read != val) {
                        printk(KERN_INFO "invalid fp write %x %x\n",
                               val_read, val);
@@ -224,8 +228,10 @@
                               subaddr, addr);
                        return -EFAULT;
                }
-       } else
+       } else {
+               kfree(buf);
                return -EFAULT;
+       }
 
        /* save last 12b value */
        if (addr == 0x12b)


--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to