HID: i2c-hid: fix memory leak during probe
authorJiri Kosina <jkosina@suse.cz>
Tue, 20 Nov 2012 16:09:40 +0000 (17:09 +0100)
committerJiri Kosina <jkosina@suse.cz>
Tue, 20 Nov 2012 16:37:45 +0000 (17:37 +0100)
In case we are returning from i2c_hid_probe() through the 'err' or
'err_mem_free' labels, there is noone freeing the buffers allocated by
i2c_hid_alloc_buffers().

Reviewed-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/hid/i2c-hid/i2c-hid.c

index 11140bdae660e14e9f2b3ccac6b56f17985c0ff3..67ab5b7b64d8a8e31d4d3ec540a9779f4cfc9173 100644 (file)
@@ -892,6 +892,7 @@ err:
        if (ihid->irq)
                free_irq(ihid->irq, ihid);
 
+       i2c_hid_free_buffers(ihid);
        kfree(ihid);
        return ret;
 }