ffmpegdec fix possible memleak (thx DboxOldie)

This commit is contained in:
BPanther
2019-03-04 21:58:37 +01:00
committed by Thilo Graf
parent 052d9c07f5
commit d1f4f82f6a
2 changed files with 15 additions and 15 deletions

View File

@@ -124,12 +124,12 @@ static int64_t seek_packet(void *opaque, int64_t offset, int whence)
bool CFfmpegDec::Init(void *_in, const CFile::FileType /* ft */) bool CFfmpegDec::Init(void *_in, const CFile::FileType /* ft */)
{ {
title = ""; title = "";
artist = ""; artist = "";
date = ""; date = "";
album = ""; album = "";
genre = ""; genre = "";
type_info = ""; type_info = "";
total_time = 0; total_time = 0;
bitrate = 0; bitrate = 0;
@@ -192,8 +192,8 @@ bool CFfmpegDec::Init(void *_in, const CFile::FileType /* ft */)
char buf[200]; av_strerror(r, buf, sizeof(buf)); char buf[200]; av_strerror(r, buf, sizeof(buf));
fprintf(stderr, "%d %s %d: %s\n", __LINE__, __func__,r,buf); fprintf(stderr, "%d %s %d: %s\n", __LINE__, __func__,r,buf);
if (avioc) if (avioc)
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55, 28, 1) #if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(57, 83, 100))
av_free(avc->pb); av_free(avioc);
#else #else
avio_context_free(&avioc); avio_context_free(&avioc);
#endif #endif
@@ -211,7 +211,7 @@ void CFfmpegDec::DeInit(void)
{ {
if (avc) { if (avc) {
if (avc->pb) if (avc->pb)
#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55, 28, 1) #if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(57, 83, 100))
av_free(avc->pb); av_free(avc->pb);
#else #else
avio_context_free(&avc->pb); avio_context_free(&avc->pb);

View File

@@ -61,12 +61,12 @@ private:
void DeInit(void); void DeInit(void);
void GetMeta(AVDictionary * metadata); void GetMeta(AVDictionary * metadata);
std::string title; std::string title;
std::string artist; std::string artist;
std::string date; std::string date;
std::string album; std::string album;
std::string genre; std::string genre;
std::string type_info; std::string type_info;
time_t total_time; time_t total_time;
int bitrate; int bitrate;
int samplerate; int samplerate;