From 02db592014f7ac1986627b9dcefddb7b91b9d9ae Mon Sep 17 00:00:00 2001 From: Maksim Shabunin Date: Mon, 10 Jul 2017 23:14:02 +0300 Subject: [PATCH] Fixed several issues found by static analysis (Windows specific) --- .../core/src/opencl/runtime/opencl_core.cpp | 1 + modules/videoio/src/cap_dshow.cpp | 22 ++++++++++++++----- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/modules/core/src/opencl/runtime/opencl_core.cpp b/modules/core/src/opencl/runtime/opencl_core.cpp index 5c466114ff..34ae5d8311 100644 --- a/modules/core/src/opencl/runtime/opencl_core.cpp +++ b/modules/core/src/opencl/runtime/opencl_core.cpp @@ -116,6 +116,7 @@ static void* WinGetProcAddress(const char* name) else if (GetProcAddress(handle, OPENCL_FUNC_TO_CHECK_1_1) == NULL) { fprintf(stderr, ERROR_MSG_INVALID_VERSION); + FreeLibrary(handle); handle = NULL; } } diff --git a/modules/videoio/src/cap_dshow.cpp b/modules/videoio/src/cap_dshow.cpp index 200edc71c1..5e84da78be 100644 --- a/modules/videoio/src/cap_dshow.cpp +++ b/modules/videoio/src/cap_dshow.cpp @@ -608,9 +608,9 @@ class videoInput{ GUID CAPTURE_MODE; //Extra video subtypes - GUID MEDIASUBTYPE_Y800; - GUID MEDIASUBTYPE_Y8; - GUID MEDIASUBTYPE_GREY; + // GUID MEDIASUBTYPE_Y800; + // GUID MEDIASUBTYPE_Y8; + // GUID MEDIASUBTYPE_GREY; videoDevice * VDList[VI_MAX_CAMERAS]; GUID mediaSubtypes[VI_NUM_TYPES]; @@ -665,6 +665,9 @@ public: latestBufferLength = 0; hEvent = CreateEvent(NULL, true, false, NULL); + pixels = 0; + ptrBuffer = 0; + numBytes = 0; } @@ -798,6 +801,10 @@ videoDevice::videoDevice(){ autoReconnect = false; requestedFrameTime = -1; + pBuffer = 0; + pixels = 0; + formatType = 0; + memset(wDeviceName, 0, sizeof(WCHAR) * 255); memset(nDeviceName, 0, sizeof(char) * 255); @@ -1060,15 +1067,18 @@ videoInput::videoInput(){ callbackSetCount = 0; bCallback = true; + connection = PhysConn_Video_Composite; + CAPTURE_MODE = PIN_CATEGORY_PREVIEW; + //setup a max no of device objects for(int i=0; i