spek

Acoustic spectrum analyser
git clone http://git.hanabi.in/repos/spek.git
Log | Files | Refs | README

commit e71dba7c88cd967d7a8e9b6f4eb9576eaa689de5
parent 8c68b3f53dcb2dc04089817ff530f9ecd3142f2b
Author: Alexander Kojevnikov <alexander@kojevnikov.com>
Date:   Wed, 20 Feb 2013 19:51:29 -0800

Fix a memory leak

Diffstat:
M.gitignore | 2--
Msrc/spek-audio.cc | 6++++++
2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -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 diff --git a/src/spek-audio.cc b/src/spek-audio.cc @@ -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); } }