aboutsummaryrefslogtreecommitdiffstats
path: root/utils/qvidcap
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2018-09-18 16:21:22 +0200
committerHans Verkuil <hans.verkuil@cisco.com>2018-09-18 16:21:22 +0200
commit0ed116049b9365658d858d07279779685455fd70 (patch)
tree280cef0f48371aeffcd22eb58dafa3079fb58cc7 /utils/qvidcap
parentdea954e56e3d0886d7e679ff08e3535b73f3617c (diff)
qvidcap: allocate worst case memory if canOverrideResolution is set
If the AppMode is one where the user can override the resolution and pixelformat, then the allocated buffers must be sized for worst-case, otherwise you can get segfaults. Also (oops!) delete the old buffer, which wasn't done. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Diffstat (limited to 'utils/qvidcap')
-rw-r--r--utils/qvidcap/capture-win-gl.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/utils/qvidcap/capture-win-gl.cpp b/utils/qvidcap/capture-win-gl.cpp
index 00baa643..95177115 100644
--- a/utils/qvidcap/capture-win-gl.cpp
+++ b/utils/qvidcap/capture-win-gl.cpp
@@ -1331,7 +1331,11 @@ void CaptureGLWin::startTimer()
for (unsigned p = 0; p < m_v4l_fmt.g_num_planes(); p++) {
m_curSize[p] = m_v4l_fmt.g_sizeimage(p);
- m_curData[p] = new __u8[m_curSize[p]];
+ delete [] m_curData[p];
+ if (m_canOverrideResolution)
+ m_curData[p] = new __u8[4096 * 2160 * (p ? 2 : 4)];
+ else
+ m_curData[p] = new __u8[m_curSize[p]];
if (m_file.isOpen())
m_file.read((char *)m_curData[p], m_curSize[p]);
else

Privacy Policy