Skip to content

Commit a8d78d1

Browse files
author
Clement Champetier
committed
ICodec: fix free avcodec in destructor
Close and free avcodec in destructor only if AVCodecContext and AVCodec are not NULL.
1 parent b08bead commit a8d78d1

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/AvTranscoder/codec/ICodec.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,12 @@ ICodec::ICodec( const ECodecType type, const AVCodecID codecId )
2929

3030
ICodec::~ICodec()
3131
{
32-
if( ! _codecContext )
32+
if( _codecContext && _codec )
3333
{
3434
avcodec_close( _codecContext );
3535
av_free( _codecContext );
3636
_codecContext = NULL;
37+
_codec = NULL;
3738
}
3839
}
3940

0 commit comments

Comments
 (0)