[x265] [PATCH] fix memory leak caused due to undeleted frameEncoders

santhoshini at multicorewareinc.com santhoshini at multicorewareinc.com
Thu Feb 5 08:02:09 CET 2015


# HG changeset patch
# User Santhoshini Sekar<santhoshini at multicorewareinc.com>
# Date 1423119443 -19800
#      Thu Feb 05 12:27:23 2015 +0530
# Node ID 1ac954705ee548449c0fac3026a1e76d800b3595
# Parent  bd4febc33ccc0a51228bc4884c7a5287fea8fea8
fix memory leak caused due to undeleted frameEncoders

diff -r bd4febc33ccc -r 1ac954705ee5 source/encoder/encoder.cpp
--- a/source/encoder/encoder.cpp	Thu Feb 05 11:48:13 2015 +0530
+++ b/source/encoder/encoder.cpp	Thu Feb 05 12:27:23 2015 +0530
@@ -285,9 +285,13 @@
 
     for (int i = 0; i < m_param->frameNumThreads; i++)
     {
-        // Ensure frame encoder is idle before destroying it
-        m_frameEncoder[i]->getEncodedPicture(m_nalList);
-        m_frameEncoder[i]->destroy();
+        if (m_frameEncoder[i])
+        {
+            // Ensure frame encoder is idle before destroying it
+            m_frameEncoder[i]->getEncodedPicture(m_nalList);
+            m_frameEncoder[i]->destroy();
+            delete m_frameEncoder[i];
+        }
     }
 
     for (int i = 0; i < m_numThreadLocalData; i++)


More information about the x265-devel mailing list