diff options
author | Hans Verkuil <hans.verkuil@cisco.com> | 2014-08-04 09:21:08 +0200 |
---|---|---|
committer | Hans Verkuil <hans.verkuil@cisco.com> | 2014-08-04 09:21:08 +0200 |
commit | 929ab3ae0e4ab3ccfee9c10c2f097d6385a51a66 (patch) | |
tree | c396a61a39d12dc255a28d7213f462cd0a2ed4ad | |
parent | 771c9c3815e5d5b8b12ae0f9ef66d1432ca46fde (diff) |
qv4l2: fix valgrind warnings
Mostly uninitialized fields, but there was also one inverted get_interval result
check.
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-rw-r--r-- | utils/qv4l2/capture-win-gl.cpp | 1 | ||||
-rw-r--r-- | utils/qv4l2/ctrl-tab.cpp | 2 | ||||
-rw-r--r-- | utils/qv4l2/general-tab.cpp | 38 | ||||
-rw-r--r-- | utils/qv4l2/qv4l2.cpp | 10 | ||||
-rw-r--r-- | utils/v4l2-compliance/cv4l-helpers.h | 2 |
5 files changed, 32 insertions, 21 deletions
diff --git a/utils/qv4l2/capture-win-gl.cpp b/utils/qv4l2/capture-win-gl.cpp index 29cd1e26..6132e3b9 100644 --- a/utils/qv4l2/capture-win-gl.cpp +++ b/utils/qv4l2/capture-win-gl.cpp @@ -126,6 +126,7 @@ CaptureWinGLEngine::CaptureWinGLEngine() : m_WCrop(0), m_HCrop(0), m_colorspace(V4L2_COLORSPACE_REC709), + m_field(V4L2_FIELD_NONE), m_displayColorspace(V4L2_COLORSPACE_SRGB), m_screenTextureCount(0), m_formatChange(false), diff --git a/utils/qv4l2/ctrl-tab.cpp b/utils/qv4l2/ctrl-tab.cpp index bd023aab..db528b0e 100644 --- a/utils/qv4l2/ctrl-tab.cpp +++ b/utils/qv4l2/ctrl-tab.cpp @@ -642,6 +642,8 @@ void ApplicationWindow::refresh(unsigned ctrl_class) for (unsigned i = 0; i < count; i++) { unsigned id = c[cnt].id = m_classMap[ctrl_class][i]; + c[cnt].size = 0; + c[cnt].reserved2[0] = 0; if (m_ctrlMap[id].type == V4L2_CTRL_TYPE_BUTTON) continue; if (m_ctrlMap[id].flags & V4L2_CTRL_FLAG_WRITE_ONLY) diff --git a/utils/qv4l2/general-tab.cpp b/utils/qv4l2/general-tab.cpp index 68079ae3..02abd3f7 100644 --- a/utils/qv4l2/general-tab.cpp +++ b/utils/qv4l2/general-tab.cpp @@ -1571,7 +1571,7 @@ void GeneralTab::vbiMethodsChanged(int idx) void GeneralTab::cropChanged() { - v4l2_selection sel; + v4l2_selection sel = { 0 }; if (!m_cropWidth->isEnabled() || !cur_io_has_crop()) return; @@ -1588,7 +1588,7 @@ void GeneralTab::cropChanged() void GeneralTab::composeChanged() { - v4l2_selection sel; + v4l2_selection sel = { 0 }; if (!m_composeWidth->isEnabled() || !cur_io_has_compose()) return; @@ -1748,13 +1748,14 @@ void GeneralTab::updateStandard() v4l2_standard vs; QString what; - g_std(std); - if (!enum_std(vs, true)) { - do { - if (vs.id == std) - break; - } while (!enum_std(vs)); - } + if (g_std(std)) + return; + if (enum_std(vs, true)) + return; + do { + if (vs.id == std) + break; + } while (!enum_std(vs)); if (vs.id != std) { if (!enum_std(vs, true)) { do { @@ -1825,13 +1826,14 @@ void GeneralTab::updateTimings() v4l2_enum_dv_timings p; QString what; - g_dv_timings(timings); - if (!enum_dv_timings(p, true)) { - do { - if (!memcmp(&timings, &p.timings, sizeof(timings))) - break; - } while (!enum_dv_timings(p)); - } + if (g_dv_timings(timings)) + return; + if (enum_dv_timings(p, true)) + return; + do { + if (!memcmp(&timings, &p.timings, sizeof(timings))) + break; + } while (!enum_dv_timings(p)); if (memcmp(&timings, &p.timings, sizeof(timings))) return; m_videoTimings->setCurrentIndex(p.index); @@ -1992,7 +1994,7 @@ void GeneralTab::updateCrop() if (m_cropWidth == NULL || !m_cropWidth->isEnabled()) return; - v4l2_selection sel; + v4l2_selection sel = { 0 }; v4l2_rect &r = sel.r; v4l2_rect b = { 0, 0, m_width, m_height }; @@ -2036,7 +2038,7 @@ void GeneralTab::updateCompose() if (m_composeWidth == NULL || !m_composeWidth->isEnabled()) return; - v4l2_selection sel; + v4l2_selection sel = { 0 }; v4l2_rect &r = sel.r; v4l2_rect b = { 0, 0, m_width, m_height }; diff --git a/utils/qv4l2/qv4l2.cpp b/utils/qv4l2/qv4l2.cpp index ec4edc9e..2023dbab 100644 --- a/utils/qv4l2/qv4l2.cpp +++ b/utils/qv4l2/qv4l2.cpp @@ -1279,9 +1279,12 @@ void ApplicationWindow::capStart(bool start) } m_capSrcFormat.s_type(g_type()); - g_fmt(m_capSrcFormat); + if (g_fmt(m_capSrcFormat)) { + error("could not obtain a source format\n"); + return; + } s_fmt(m_capSrcFormat); - if (!m_genTab->get_interval(interval)) + if (m_genTab->get_interval(interval)) set_interval(interval); m_frameData = new unsigned char[m_capSrcFormat.g_sizeimage(0) + @@ -1382,7 +1385,7 @@ void ApplicationWindow::closeDevice() delete m_ctrlNotifier; m_ctrlNotifier = NULL; } - delete m_frameData; + delete [] m_frameData; m_frameData = NULL; v4lconvert_destroy(m_convertData); cv4l_fd::close(); @@ -1393,6 +1396,7 @@ void ApplicationWindow::closeDevice() m_tabs->removeTab(0); delete page; } + m_genTab = NULL; m_ctrlMap.clear(); m_widgetMap.clear(); m_sliderMap.clear(); diff --git a/utils/v4l2-compliance/cv4l-helpers.h b/utils/v4l2-compliance/cv4l-helpers.h index 1b01a6ca..be870559 100644 --- a/utils/v4l2-compliance/cv4l-helpers.h +++ b/utils/v4l2-compliance/cv4l-helpers.h @@ -451,6 +451,7 @@ public: v4l2_streamparm parm; parm.type = type ? type : g_type(); + memset(parm.parm.capture.reserved, 0, sizeof(parm.parm.capture.reserved)); if (cv4l_ioctl(VIDIOC_G_PARM, &parm) || !(parm.parm.capture.capability & V4L2_CAP_TIMEPERFRAME)) return -1; @@ -465,6 +466,7 @@ public: v4l2_streamparm parm; parm.type = type ? type : g_type(); + memset(parm.parm.capture.reserved, 0, sizeof(parm.parm.capture.reserved)); if (cv4l_ioctl(VIDIOC_G_PARM, &parm) == 0 && (parm.parm.capture.capability & V4L2_CAP_TIMEPERFRAME)) { interval = parm.parm.capture.timeperframe; |