[Kdenlive-devel] [PATCH 08/14] keyframehelper.cpp: free allocated memory
Mikko Rapeli
mikko.rapeli at iki.fi
Sun Jul 22 18:28:16 UTC 2012
Coverity says:
82 for (int i = 0; i < m_extraGeometries.count(); i++) {
At conditional (1): "<new init>@dim2 < 5U" taking the true branch.
At conditional (2): "<new init>@dim2 < 5U" taking the true branch.
At conditional (3): "<new init>@dim2 < 5U" taking the false branch.
CID 709298: Resource leak (RESOURCE_LEAK)
Calling allocation function "operator new(unsigned int)".
Assigning: "item2" = storage returned from "new Mlt::GeometryItem({{, , , , , , , , {}}})".
83 Mlt::GeometryItem *item2 = new Mlt::GeometryItem();
At conditional (4): "this->m_extraGeometries.at(i)->next_key(item, mousePos) == 0" taking the false branch.
84 if (m_extraGeometries.at(i)->next_key(item, mousePos) == 0) {
85 item2->x(item.x());
86 item2->frame(item.frame());
87 m_extraMovingItems.append(item2);
88 }
Variable "item2" going out of scope leaks the storage it points to.
89 }
---
src/keyframehelper.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/keyframehelper.cpp b/src/keyframehelper.cpp
index 5a8de19..a1c9af9 100644
--- a/src/keyframehelper.cpp
+++ b/src/keyframehelper.cpp
@@ -85,6 +85,8 @@ void KeyframeHelper::mousePressEvent(QMouseEvent * event)
item2->x(item.x());
item2->frame(item.frame());
m_extraMovingItems.append(item2);
+ } else {
+ delete(item2);
}
}
--
1.7.10.4
More information about the Kdenlive
mailing list