From 4f1e47191b728d64c2381c40525392a2ba96a73a Mon Sep 17 00:00:00 2001 From: Frankenstone Date: Sun, 3 Mar 2019 22:20:24 +0100 Subject: [PATCH] ffmpegdec.cpp: fix possible memleak --- src/driver/audiodec/ffmpegdec.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/driver/audiodec/ffmpegdec.cpp b/src/driver/audiodec/ffmpegdec.cpp index 3dadd2924..c3bdd9f06 100644 --- a/src/driver/audiodec/ffmpegdec.cpp +++ b/src/driver/audiodec/ffmpegdec.cpp @@ -192,7 +192,7 @@ bool CFfmpegDec::Init(void *_in, const CFile::FileType /* ft */) char buf[200]; av_strerror(r, buf, sizeof(buf)); fprintf(stderr, "%d %s %d: %s\n", __LINE__, __func__,r,buf); if (avioc) - av_freep(avioc); + avio_context_free(&avioc); if (avc) { avformat_close_input(&avc); avformat_free_context(avc); @@ -206,15 +206,12 @@ bool CFfmpegDec::Init(void *_in, const CFile::FileType /* ft */) void CFfmpegDec::DeInit(void) { if (avc) { + if (avc->pb) + avio_context_free(&avc->pb); avformat_close_input(&avc); -#if 0 - av_freep(&avc->pb); -#endif avformat_free_context(avc); avc = NULL; } -// if (buffer) -// av_freep(&buffer); in = NULL; }