From: Johan Hovold Date: Wed, 30 Dec 2015 10:08:01 +0000 (+0100) Subject: greybus: camera: fix memory leak in capture-request handler X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b9f71bc854105148f38d0c2336ed7c9b50a97800;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git greybus: camera: fix memory leak in capture-request handler Fix memory leak in capture-request handler by making sure to release the operation request buffer after sending the request. Signed-off-by: Johan Hovold Reviewed-by: Laurent Pinchart Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/staging/greybus/camera.c b/drivers/staging/greybus/camera.c index 8b2eedd29cb3..ec7d4a082ab1 100644 --- a/drivers/staging/greybus/camera.c +++ b/drivers/staging/greybus/camera.c @@ -183,6 +183,7 @@ static int gb_camera_capture(struct gb_camera *gcam, u32 request_id, { struct gb_camera_capture_request *req; size_t req_size; + int ret; if (settings_size > GB_CAMERA_MAX_SETTINGS_SIZE) return -EINVAL; @@ -198,8 +199,12 @@ static int gb_camera_capture(struct gb_camera *gcam, u32 request_id, req->num_frames = cpu_to_le16(num_frames); memcpy(req->settings, settings, settings_size); - return gb_operation_sync(gcam->connection, GB_CAMERA_TYPE_CAPTURE, + ret = gb_operation_sync(gcam->connection, GB_CAMERA_TYPE_CAPTURE, req, req_size, NULL, 0); + + kfree(req); + + return ret; } static int gb_camera_flush(struct gb_camera *gcam, u32 *request_id)