shithub: openh264

Download patch

ref: 2b9a250fbda09220e480898421926d8ebdb498fd
parent: a1a3873a62b8dbaed584b5b02e73ceae69f26ba0
author: sijchen <[email protected]>
date: Fri Feb 12 10:29:06 EST 2016

include the free-ing of pointer into FreeDqLayer

--- a/codec/encoder/core/src/encoder_ext.cpp
+++ b/codec/encoder/core/src/encoder_ext.cpp
@@ -952,7 +952,7 @@
   }
 }
 
-void FreeDqLayer (SDqLayer* pDq, CMemoryAlign* pMa) {
+void FreeDqLayer (SDqLayer*& pDq, CMemoryAlign* pMa) {
   if (NULL == pDq) {
     return;
   }
@@ -996,6 +996,9 @@
 
   UninitSlicePEncCtx (pDq, pMa);
   pDq->iMaxSliceNum = 0;
+
+  pMa->WelsFree (pDq, "pDqLayer");
+  pDq = NULL;
 }
 
 
@@ -2192,8 +2195,6 @@
         // pDq layers
         if (NULL != pDq) {
           FreeDqLayer (pDq, pMa);
-          pMa->WelsFree (pDq, "pDq");
-          pDq = NULL;
           pCtx->ppDqLayerList[ilayer] = NULL;
         }
         ++ ilayer;