Fix a memory leak

This commit is contained in:
Alexander Kojevnikov 2013-02-20 19:51:29 -08:00
parent 8c68b3f53d
commit e71dba7c88
2 changed files with 6 additions and 2 deletions

2
.gitignore vendored
View File

@ -38,11 +38,9 @@ po/*.gmo
po/.intltool-merge-cache
po/POTFILES
po/stamp-it
samples/
src/*.stamp
src/spek
stamp-h1
tests/test
tests/test-utils
web/version
xmldocs.make

View File

@ -222,6 +222,12 @@ AudioFileImpl::~AudioFileImpl()
av_free_packet(&this->packet);
}
if (this->format_context) {
if (this->audio_stream >= 0) {
auto codec_context = this->format_context->streams[this->audio_stream]->codec;
if (codec_context) {
avcodec_close(codec_context);
}
}
avformat_close_input(&this->format_context);
}
}