[xiph-commits] r15150 - in trunk/oggdsf/src/lib: codecs/theora/libs/libOOTheora core/directshow/dsfOggDemux2

cristianadam at svn.xiph.org cristianadam at svn.xiph.org
Sun Aug 3 09:39:45 PDT 2008


Author: cristianadam
Date: 2008-08-03 09:39:43 -0700 (Sun, 03 Aug 2008)
New Revision: 15150

Modified:
   trunk/oggdsf/src/lib/codecs/theora/libs/libOOTheora/TheoraDecoder.cpp
   trunk/oggdsf/src/lib/codecs/theora/libs/libOOTheora/TheoraEncoder.cpp
   trunk/oggdsf/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.cpp
Log:
Fixed ticket #1408 (libOOTheora.dll memory leak)

Modified: trunk/oggdsf/src/lib/codecs/theora/libs/libOOTheora/TheoraDecoder.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/libs/libOOTheora/TheoraDecoder.cpp	2008-08-03 13:12:26 UTC (rev 15149)
+++ trunk/oggdsf/src/lib/codecs/theora/libs/libOOTheora/TheoraDecoder.cpp	2008-08-03 16:39:43 UTC (rev 15150)
@@ -41,10 +41,26 @@
 	, mTheoraState(NULL)
 #endif
 {
+#ifndef USE_THEORA_EXP
+	memset(&mTheoraState, 0, sizeof(mTheoraState));
+#endif
 }
 
 TheoraDecoder::~TheoraDecoder(void)
 {
+#ifdef USE_THEORA_EXP
+	th_comment_clear(&mTheoraComment);
+	th_info_clear(&mTheoraInfo);
+
+	th_decode_free(mTheoraState);
+	th_setup_free(mTheoraSetup);
+#else
+	theora_comment_clear(&mTheoraComment); 
+	theora_info_clear(&mTheoraInfo); 
+
+	theora_clear(&mTheoraState); 
+#endif
+
 }
 
 bool TheoraDecoder::initCodec() 

Modified: trunk/oggdsf/src/lib/codecs/theora/libs/libOOTheora/TheoraEncoder.cpp
===================================================================
--- trunk/oggdsf/src/lib/codecs/theora/libs/libOOTheora/TheoraEncoder.cpp	2008-08-03 13:12:26 UTC (rev 15149)
+++ trunk/oggdsf/src/lib/codecs/theora/libs/libOOTheora/TheoraEncoder.cpp	2008-08-03 16:39:43 UTC (rev 15150)
@@ -34,10 +34,18 @@
 
 TheoraEncoder::TheoraEncoder(void)
 {
+	memset(&mTheoraInfo, 0, sizeof(mTheoraInfo));
+	memset(&mTheoraComment, 0, sizeof(mTheoraComment));
+	
+	memset(&mTheoraState, 0, sizeof(mTheoraState));
 }
 
 TheoraEncoder::~TheoraEncoder(void)
 {
+	theora_info_clear(&mTheoraInfo);
+	theora_comment_clear(&mTheoraComment);
+	
+	theora_clear(&mTheoraState);
 }
 
 /** Returns three header packets which you must delete when done. Give it a theora_info.

Modified: trunk/oggdsf/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.cpp
===================================================================
--- trunk/oggdsf/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.cpp	2008-08-03 13:12:26 UTC (rev 15149)
+++ trunk/oggdsf/src/lib/core/directshow/dsfOggDemux2/OggDemuxPacketSourceFilter.cpp	2008-08-03 16:39:43 UTC (rev 15150)
@@ -169,8 +169,11 @@
 	delete mStreamLock;
 	delete mSourceFileLock;
 
-	mDataSource->close();
-	delete mDataSource;
+	if (mDataSource)
+	{
+		mDataSource->close();
+		delete mDataSource;
+	}
 }
 //IMEdiaStreaming
 STDMETHODIMP OggDemuxPacketSourceFilter::Run(REFERENCE_TIME tStart) 



More information about the commits mailing list