Index: trunk/source/App/TAppDecoder/TAppDecCfg.cpp
===================================================================
--- trunk/source/App/TAppDecoder/TAppDecCfg.cpp	(revision 120)
+++ trunk/source/App/TAppDecoder/TAppDecCfg.cpp	(revision 121)
@@ -103,5 +103,5 @@
   if (!m_pchBitstreamFile)
   {
-    fprintf(stderr, "No input file specifed, aborting\n");
+    fprintf(stderr, "No input file specified, aborting\n");
     return false;
   }
Index: trunk/source/App/TAppEncoder/TAppEncCfg.cpp
===================================================================
--- trunk/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 120)
+++ trunk/source/App/TAppEncoder/TAppEncCfg.cpp	(revision 121)
@@ -120,4 +120,25 @@
 #endif
 
+#if FIX_MEM_LEAKS
+ if ( m_pchCameraParameterFile != NULL )
+   free ( m_pchCameraParameterFile ); 
+
+ if ( m_pchBaseViewCameraNumbers != NULL )
+   free ( m_pchBaseViewCameraNumbers ); 
+
+ if ( m_pchdQPFile      != NULL ) 
+   free ( m_pchdQPFile      );
+
+ if ( m_pchColumnWidth  != NULL ) 
+   free ( m_pchColumnWidth  );
+
+ if ( m_pchRowHeight    != NULL ) 
+   free ( m_pchRowHeight    );
+
+ if ( m_scalingListFile != NULL ) 
+   free ( m_scalingListFile );
+
+#endif   
+
 }
 
@@ -228,5 +249,5 @@
   ("FrameSkip,-fs",         m_FrameSkip,         0u, "Number of frames to skip at start of input YUV")
   ("FramesToBeEncoded,f",   m_iFrameToBeEncoded, 0, "number of frames to be encoded (default=all)")
-  ("FrameToBeEncoded",      m_iFrameToBeEncoded, 0, "depricated alias of FramesToBeEncoded")
+  ("FrameToBeEncoded",        m_iFrameToBeEncoded, 0, "deprecated alias of FramesToBeEncoded")
   
   ("NumberOfViews",         m_iNumberOfViews,    0, "Number of views")
Index: trunk/source/App/TAppEncoder/TAppEncTop.cpp
===================================================================
--- trunk/source/App/TAppEncoder/TAppEncTop.cpp	(revision 120)
+++ trunk/source/App/TAppEncoder/TAppEncTop.cpp	(revision 121)
@@ -1000,4 +1000,14 @@
   pcDepthPicYuvOrg = NULL;
   
+#if FIX_MEM_LEAKS
+  if ( pcPdmDepthOrg != NULL )
+  {
+    pcPdmDepthOrg->destroy();
+    delete pcPdmDepthOrg;     
+    pcPdmDepthOrg = NULL; 
+  };
+#endif
+
+  
   for(Int iViewIdx=0; iViewIdx < m_iNumberOfViews; iViewIdx++ )
   {
Index: trunk/source/Lib/TLibCommon/TComDataCU.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComDataCU.cpp	(revision 120)
+++ trunk/source/Lib/TLibCommon/TComDataCU.cpp	(revision 121)
@@ -90,7 +90,10 @@
   m_pcTrCoeffCr        = NULL;
 #if ADAPTIVE_QP_SELECTION  
+#if FIX_MEM_LEAKS
+  m_ArlCoeffIsAliasedAllocation = false;
   m_pcArlCoeffY        = NULL;
   m_pcArlCoeffCb       = NULL;
   m_pcArlCoeffCr       = NULL;
+#endif
 #endif
   
@@ -247,4 +250,7 @@
       m_pcArlCoeffCb       = m_pcGlbArlCoeffCb;
       m_pcArlCoeffCr       = m_pcGlbArlCoeffCr;
+#if FIX_MEM_LEAKS
+      m_ArlCoeffIsAliasedAllocation = true;
+#endif
     }
     else
@@ -362,4 +368,12 @@
     if ( m_pcTrCoeffCr        ) { xFree(m_pcTrCoeffCr);         m_pcTrCoeffCr       = NULL; }
 #if ADAPTIVE_QP_SELECTION
+#if FIX_MEM_LEAKS
+    if (!m_ArlCoeffIsAliasedAllocation)
+    {
+      xFree(m_pcArlCoeffY); m_pcArlCoeffY = 0;
+      xFree(m_pcArlCoeffCb); m_pcArlCoeffCb = 0;
+      xFree(m_pcArlCoeffCr); m_pcArlCoeffCr = 0;
+    }
+#endif
     if ( m_pcGlbArlCoeffY     ) { xFree(m_pcGlbArlCoeffY);      m_pcGlbArlCoeffY    = NULL; }
     if ( m_pcGlbArlCoeffCb    ) { xFree(m_pcGlbArlCoeffCb);     m_pcGlbArlCoeffCb   = NULL; }
Index: trunk/source/Lib/TLibCommon/TComDataCU.h
===================================================================
--- trunk/source/Lib/TLibCommon/TComDataCU.h	(revision 120)
+++ trunk/source/Lib/TLibCommon/TComDataCU.h	(revision 121)
@@ -159,8 +159,12 @@
   Int*          m_pcArlCoeffCb;       ///< ARL coefficient buffer (Cb)
   Int*          m_pcArlCoeffCr;       ///< ARL coefficient buffer (Cr)
+#if FIX_MEM_LEAKS
+  Bool          m_ArlCoeffIsAliasedAllocation; ///< ARL coefficient buffer is an alias of the global buffer and must not be free()'d
+#endif 
 
   static Int*   m_pcGlbArlCoeffY;     ///< ARL coefficient buffer (Y)
   static Int*   m_pcGlbArlCoeffCb;    ///< ARL coefficient buffer (Cb)
   static Int*   m_pcGlbArlCoeffCr;    ///< ARL coefficient buffer (Cr)
+
 #endif
   
Index: trunk/source/Lib/TLibCommon/TComPicSym.cpp
===================================================================
--- trunk/source/Lib/TLibCommon/TComPicSym.cpp	(revision 120)
+++ trunk/source/Lib/TLibCommon/TComPicSym.cpp	(revision 121)
@@ -122,4 +122,12 @@
   m_apcTComDataCU = NULL;
 
+
+#if FIX_MEM_LEAKS
+  for( i=0; i<(m_iNumColumnsMinus1+1)*(m_iNumRowsMinus1+1); i++ )
+  {
+    if ( m_apcTComTile[i] )  delete m_apcTComTile[i];
+  }
+#endif
+
   delete [] m_apcTComTile;
   m_apcTComTile = NULL;
Index: trunk/source/Lib/TLibCommon/TypeDef.h
===================================================================
--- trunk/source/Lib/TLibCommon/TypeDef.h	(revision 120)
+++ trunk/source/Lib/TLibCommon/TypeDef.h	(revision 121)
@@ -47,6 +47,8 @@
 #define FIX_INIT_ROM                      1
 #define FIX_VIRT_DESTRUCTOR               1
+#define FIX_MEM_LEAKS                     1
 
 #define FIX_LG_RESTRICTEDRESPRED_M24766   1
+#define FIX_REMOVE_TILE_DEPENDENCE        1
 
 
Index: trunk/source/Lib/TLibEncoder/TEncCfg.h
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncCfg.h	(revision 120)
+++ trunk/source/Lib/TLibEncoder/TEncCfg.h	(revision 121)
@@ -272,5 +272,8 @@
   Int       m_iColumnRowInfoPresent;
   Int       m_iUniformSpacingIdr;
+#if FIX_REMOVE_TILE_DEPENDENCE
+#else
   Int       m_iTileBoundaryIndependenceIdr;
+#endif
   Int       m_iNumColumnsMinus1;
   UInt*     m_puiColumnWidth;
@@ -287,5 +290,5 @@
   Int       m_iWaveFrontSubstreams;
 
-  bool m_pictureDigestEnabled; ///< enable(1)/disable(0) md5 computation and SEI signalling
+  Bool      m_pictureDigestEnabled; ///< enable(1)/disable(0) md5 computation and SEI signalling
 
   //====== Weighted Prediction ========
Index: trunk/source/Lib/TLibEncoder/TEncTop.cpp
===================================================================
--- trunk/source/Lib/TLibEncoder/TEncTop.cpp	(revision 120)
+++ trunk/source/Lib/TLibEncoder/TEncTop.cpp	(revision 121)
@@ -1102,5 +1102,9 @@
 
     // # substreams is "per tile" when tiles are independent.
+#if FIX_REMOVE_TILE_DEPENDENCE
+    if ( m_iWaveFrontSynchro )
+#else
     if (m_iTileBoundaryIndependenceIdr && m_iWaveFrontSynchro)
+#endif
     {
       m_cPPS.setNumSubstreams(m_iWaveFrontSubstreams * (m_iNumColumnsMinus1+1)*(m_iNumRowsMinus1+1));
Index: trunk/source/Lib/TLibRenderer/TRenSingleModel.cpp
===================================================================
--- trunk/source/Lib/TLibRenderer/TRenSingleModel.cpp	(revision 120)
+++ trunk/source/Lib/TLibRenderer/TRenSingleModel.cpp	(revision 121)
@@ -99,5 +99,19 @@
   if ( m_pcInputSamples [0] ) delete[] m_pcInputSamples [0];
   if ( m_pcInputSamples [1] ) delete[] m_pcInputSamples [1];
+
+#if FIX_MEM_LEAKS
+  if ( m_pcOutputSamples    ) delete[] m_pcOutputSamples   ;
+#else
   if ( m_pcOutputSamples    ) delete   m_pcOutputSamples   ;
+#endif
+
+#if FIX_MEM_LEAKS
+  if ( m_piInvZLUTLeft  ) delete[] m_piInvZLUTLeft ;
+  if ( m_piInvZLUTRight ) delete[] m_piInvZLUTRight;
+
+  if ( m_aapiRefVideoPel[0] ) delete[] ( m_aapiRefVideoPel[0] - ( m_aiRefVideoStrides[0] * m_iPad + m_iPad ) );
+  if ( m_aapiRefVideoPel[1] ) delete[] ( m_aapiRefVideoPel[1] - ( m_aiRefVideoStrides[1] * m_iPad + m_iPad ) );
+  if ( m_aapiRefVideoPel[2] ) delete[] ( m_aapiRefVideoPel[2] - ( m_aiRefVideoStrides[2] * m_iPad + m_iPad ) );
+#endif
 }
 
