diff options
author | Johan Hovold <johan@hovoldconsulting.com> | 2015-12-30 11:08:01 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@google.com> | 2015-12-30 13:16:06 -0800 |
commit | b9f71bc854105148f38d0c2336ed7c9b50a97800 (patch) | |
tree | 2f66b766636bbd6a4267de5a2bc7f7198ced2791 /drivers/staging/greybus/camera.c | |
parent | 12c8b0dcc884cc7f1f925cd1ed08cf8cdc95e7ef (diff) | |
download | op-kernel-dev-b9f71bc854105148f38d0c2336ed7c9b50a97800.zip op-kernel-dev-b9f71bc854105148f38d0c2336ed7c9b50a97800.tar.gz |
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 <johan@hovoldconsulting.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Diffstat (limited to 'drivers/staging/greybus/camera.c')
-rw-r--r-- | drivers/staging/greybus/camera.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/staging/greybus/camera.c b/drivers/staging/greybus/camera.c index 8b2eedd..ec7d4a0 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) |