From 7d77cd75fe9bee121dbc6191791a6b069f3114f1 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sat, 18 Nov 2017 09:45:47 -0500 Subject: [PATCH] eliminate redundant code and memleak --- src/zm_ffmpeg.cpp | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/zm_ffmpeg.cpp b/src/zm_ffmpeg.cpp index 37efe0416..ce0cd0eff 100644 --- a/src/zm_ffmpeg.cpp +++ b/src/zm_ffmpeg.cpp @@ -184,27 +184,13 @@ int hacked_up_context2_for_older_ffmpeg(AVFormatContext **avctx, AVOutputFormat } } - if (!oformat) { - if (format) { - oformat = av_guess_format(format, NULL, NULL); - if (!oformat) { - av_log(s, AV_LOG_ERROR, "Requested output format '%s' is not a suitable output format\n", format); - ret = AVERROR(EINVAL); - } - } else { - oformat = av_guess_format(NULL, filename, NULL); - if (!oformat) { - ret = AVERROR(EINVAL); - av_log(s, AV_LOG_ERROR, "Unable to find a suitable output format for '%s'\n", filename); - } - } - } - if (ret) { avformat_free_context(s); return ret; } else { s->oformat = oformat; +#if 0 + // This is some very wrong code, and I don't think it is neccessary if (s->oformat->priv_data_size > 0) { s->priv_data = av_mallocz(s->oformat->priv_data_size); if (s->priv_data) { @@ -219,6 +205,7 @@ int hacked_up_context2_for_older_ffmpeg(AVFormatContext **avctx, AVOutputFormat } s->priv_data = NULL; } +#endif if (filename) strncpy(s->filename, filename, sizeof(s->filename)); *avctx = s;