Fix memory leak in compositor code with RGB curve nodes.
authorLukas Tönne <lukas.toenne@gmail.com>
Thu, 1 Oct 2015 16:11:12 +0000 (18:11 +0200)
committerLukas Tönne <lukas.toenne@gmail.com>
Thu, 1 Oct 2015 16:11:12 +0000 (18:11 +0200)
source/blender/compositor/operations/COM_CurveBaseOperation.cpp
source/blender/compositor/operations/COM_CurveBaseOperation.h

index 408395bfcf0397df7779c1d16a65ad7b5ebbaab3..9bb5ac88343654a4b64a4f0e7e5cf03bbb1f6b55 100644 (file)
@@ -34,14 +34,25 @@ CurveBaseOperation::CurveBaseOperation() : NodeOperation()
 {
        this->m_curveMapping = NULL;
 }
+
+CurveBaseOperation::~CurveBaseOperation()
+{
+       if (this->m_curveMapping) {
+               curvemapping_free(this->m_curveMapping);
+               this->m_curveMapping = NULL;
+       }
+}
+
 void CurveBaseOperation::initExecution()
 {
        curvemapping_initialize(this->m_curveMapping);
 }
 void CurveBaseOperation::deinitExecution()
 {
-       curvemapping_free(this->m_curveMapping);
-       this->m_curveMapping = NULL;
+       if (this->m_curveMapping) {
+               curvemapping_free(this->m_curveMapping);
+               this->m_curveMapping = NULL;
+       }
 }
 
 void CurveBaseOperation::setCurveMapping(CurveMapping *mapping)
index 6bfce26f532f4107882a7f6bc8bd8608c8890dc5..154eb18e387ac4b2e9abe90340c1001cc3d638df 100644 (file)
@@ -33,6 +33,7 @@ protected:
        CurveMapping *m_curveMapping;
 public:
        CurveBaseOperation();
+       ~CurveBaseOperation();
        
        /**
         * Initialize the execution