Skip to content
Snippets Groups Projects
Commit d4081360 authored by Ken Tossell's avatar Ken Tossell
Browse files

fix rgb_frame_ leak

parent 3ddfc561
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,8 @@ CameraDriver::~CameraDriver() { ...@@ -27,6 +27,8 @@ CameraDriver::~CameraDriver() {
} }
bool CameraDriver::Start() { bool CameraDriver::Start() {
assert(state_ == kInitial);
uvc_error_t err; uvc_error_t err;
err = uvc_init(&ctx_, NULL); err = uvc_init(&ctx_, NULL);
...@@ -187,6 +189,9 @@ void CameraDriver::OpenCamera(UVCCameraConfig &new_config) { ...@@ -187,6 +189,9 @@ void CameraDriver::OpenCamera(UVCCameraConfig &new_config) {
return; return;
} }
if (rgb_frame_)
uvc_free_frame(rgb_frame_);
rgb_frame_ = uvc_allocate_frame(new_config.width * new_config.height * 3); rgb_frame_ = uvc_allocate_frame(new_config.width * new_config.height * 3);
assert(rgb_frame_); assert(rgb_frame_);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment