diff options
author | Jesper Juhl <jj@chaosbits.net> | 2012-01-29 20:55:28 (GMT) |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2012-02-09 17:51:47 (GMT) |
commit | 881763361e8283a6d33d5a30ac6edc36e7dc6d44 (patch) | |
tree | e8cff87f3eb532fe7705282a00592bbe40cde66f /drivers/staging/media | |
parent | d0bc218b0a75bbddc9ef54aac6d9cc65a7a58661 (diff) | |
download | linux-fsl-qoriq-881763361e8283a6d33d5a30ac6edc36e7dc6d44.tar.xz |
staging, media, easycap: Fix mem leak in easycap_usb_probe()
If allocating 'pdata_urb' fails, the function will return -ENOMEM
without freeing the memory allocated, just a few lines above, for
'purb' and will leak that memory when 'purb' goes out of scope.
This patch resolves the leak by freeing the allocated storage with
usb_free_urb() before the return.
Signed-off-by: Jesper Juhl <jj@chaosbits.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/media')
-rw-r--r-- | drivers/staging/media/easycap/easycap_main.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/staging/media/easycap/easycap_main.c b/drivers/staging/media/easycap/easycap_main.c index 8ff5f38..3d439b7 100644 --- a/drivers/staging/media/easycap/easycap_main.c +++ b/drivers/staging/media/easycap/easycap_main.c @@ -3825,6 +3825,7 @@ static int easycap_usb_probe(struct usb_interface *intf, /* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */ pdata_urb = kzalloc(sizeof(struct data_urb), GFP_KERNEL); if (!pdata_urb) { + usb_free_urb(purb); SAM("ERROR: Could not allocate struct data_urb.\n"); return -ENOMEM; } |