[Kdenlive-devel] [PATCH 02/14] audioInfo.cpp: initialize m_producer pointer

Mikko Rapeli mikko.rapeli at iki.fi
Sun Jul 22 18:28:10 UTC 2012


Found by Coverity:

18AudioInfo::AudioInfo(Mlt::Producer *producer)
19{
20    // Since we already receive an MLT producer, we do not need to initialize MLT:
21    // Mlt::Factory::init(NULL);
22
23    // Get the number of streams and add the information of each of them if it is an audio stream.
24    int streams = atoi(producer->get("meta.media.nb_streams"));
At conditional (1): "i < streams" taking the true branch.
At conditional (3): "i < streams" taking the true branch.
At conditional (5): "i < streams" taking the false branch.
25    for (int i = 0; i < streams; i++) {
26        QByteArray propertyName = QString("meta.media.%1.stream.type").arg(i).toLocal8Bit();
27
At conditional (2): "strcmp("audio", producer->get(propertyName.data())) == 0" taking the true branch.
At conditional (4): "strcmp("audio", producer->get(propertyName.data())) == 0" taking the true branch.
28        if (strcmp("audio", producer->get(propertyName.data())) == 0) {
29            m_list << new AudioStreamInfo(producer, i);
30        }
31
32    }
CID 709311: Uninitialized pointer field (UNINIT_CTOR)
Non-static class member ""m_producer"" is not initialized in this constructor nor in any functions that it calls.
33}
---
 src/lib/audio/audioInfo.cpp |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/lib/audio/audioInfo.cpp b/src/lib/audio/audioInfo.cpp
index c467a96..c210ef7 100644
--- a/src/lib/audio/audioInfo.cpp
+++ b/src/lib/audio/audioInfo.cpp
@@ -15,7 +15,8 @@
 #include <iostream>
 #include <cstdlib>
 
-AudioInfo::AudioInfo(Mlt::Producer *producer)
+AudioInfo::AudioInfo(Mlt::Producer *producer) :
+m_producer(NULL)
 {
     // Since we already receive an MLT producer, we do not need to initialize MLT:
     // Mlt::Factory::init(NULL);
-- 
1.7.10.4





More information about the Kdenlive mailing list