Skip to contentSkip to conversation

usb: gadget: uvc: memory leak in uvcg_frame_make()

PATCH In review Dan Carpenter 3 participants 3 messages Jan 14, 2015 – Jan 18, 2015

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 4/6 usb: gadget: uvc: memory leak in uvcg_frame_make()

We need to add a kfree(h) on an error path.

drivers/usb/gadget/function/uvc_configfs.c +1 -0
index 738d68f..1af2686 100644
@@ -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;
Acked-by on v1 4/6
#1 lore raw

W dniu 14.01.2015 o 22:03, Dan Carpenter pisze:

Quoted 4 lines

We need to add a kfree(h) on an error path.

Quoted 17 lines
drivers/usb/gadget/function/uvc_configfs.c +1 -1
index 738d68f..1af2686 100644
@@ -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;
--

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

Acked-by on v1 4/6
#2 lore raw
In reply to Dan Carpenter

Hi Dan,

Thank you for the patch.

Quoted 3 lines · On Thursday 15 January 2015 00:03:08 Dan Carpenter wrote:

We need to add a kfree(h) on an error path.

Quoted 12 lines
(quoted diff) +0 -0

b/drivers/usb/gadget/function/uvc_configfs.c index 738d68f..1af2686 100644

drivers/usb/gadget/function/uvc_configfs.c +1 -0
@@ -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;
Signature · 3 lines
Regards,

Laurent Pinchart