From: Dan Carpenter Date: Wed, 14 Jan 2015 21:03:08 +0000 (+0300) Subject: usb: gadget: uvc: memory leak in uvcg_frame_make() X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=c5b2dc68a7a7e31d8e88b3bf9d45bd9e78e9fb78;p=openwrt%2Fstaging%2Fblogic.git usb: gadget: uvc: memory leak in uvcg_frame_make() We need to add a kfree(h) on an error path. Acked-by: Andrzej Pietrasiewicz Acked-by: Laurent Pinchart Signed-off-by: Dan Carpenter Signed-off-by: Felipe Balbi --- diff --git a/drivers/usb/gadget/function/uvc_configfs.c b/drivers/usb/gadget/function/uvc_configfs.c index 6d9c68163fe1..09028d21a3b6 100644 --- a/drivers/usb/gadget/function/uvc_configfs.c +++ b/drivers/usb/gadget/function/uvc_configfs.c @@ -1300,6 +1300,7 @@ static struct config_item *uvcg_frame_make(struct config_group *group, h->fmt_type = UVCG_MJPEG; } else { mutex_unlock(&opts->lock); + kfree(h); return ERR_PTR(-EINVAL); } ++fmt->num_frames;