From df2b591896b8c86932c6ebd1d88ed3c18c3fccd4 Mon Sep 17 00:00:00 2001 From: Guillaume Jacob Date: Mon, 17 Oct 2016 22:58:08 +0200 Subject: [PATCH] videoio: fix segfault if CONVERT_RGB is false (issue #7465) --- modules/videoio/src/cap_v4l.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/videoio/src/cap_v4l.cpp b/modules/videoio/src/cap_v4l.cpp index 9114108dfd..814b65bf13 100644 --- a/modules/videoio/src/cap_v4l.cpp +++ b/modules/videoio/src/cap_v4l.cpp @@ -1849,7 +1849,7 @@ static void icvCloseCAM_V4L( CvCaptureCAM_V4L* capture ){ if (capture->deviceHandle != -1) close(capture->deviceHandle); - if (capture->frame.imageData) + if (capture->frame_allocated && capture->frame.imageData) cvFree(&capture->frame.imageData); capture->deviceName.clear(); // flag that the capture is closed