[Kdenlive-devel] [PATCH 02/16] effectstackview2.cpp: check for null pointer

Mikko Rapeli mikko.rapeli at iki.fi
Fri Aug 10 12:17:03 UTC 2012


Fixes Coverity CID 709290: Dereference after null check (FORWARD_NULL)
Comparing "this->m_clipref" to null implies that "this->m_clipref" might be null.
717    else if (m_clipref) {
...
Passing null variable "this->m_clipref" to function "AbstractClipItem::info() const", which dereferences it. [show details]
733        info = m_clipref->info();
---
 src/effectstack/effectstackview2.cpp |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/effectstack/effectstackview2.cpp b/src/effectstack/effectstackview2.cpp
index 98591ba..c345272 100644
--- a/src/effectstack/effectstackview2.cpp
+++ b/src/effectstack/effectstackview2.cpp
@@ -729,7 +729,7 @@ void EffectStackView2::slotCreateRegion(int ix, KUrl url)
         info.startPos = GenTime(-1);
         info.track = 0;
     }
-    else {
+    else if (m_clipref) {
         info = m_clipref->info();
     }
     CollapsibleEffect *current = getEffectByIndex(ix);
@@ -744,7 +744,7 @@ void EffectStackView2::slotCreateRegion(int ix, KUrl url)
     if (m_effectMetaInfo.trackMode) {
         isSelected = currentEffect->effectIndex() == 1;
     }
-    else {
+    else if (m_clipref) {
         isSelected = currentEffect->effectIndex() == m_clipref->selectedEffectIndex();
     }
     if (isSelected) currentEffect->setActive(true);
-- 
1.7.10.4





More information about the Kdenlive mailing list