From 3cffbe090a5168dcfe580de8d662a32e7ad1d911 Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 16 Aug 2008 14:46:31 +0000 Subject: Fix rc_eq mem leak. Originally committed as revision 14788 to svn://svn.ffmpeg.org/ffmpeg/trunk --- libavcodec/ratecontrol.c | 2 +- libavcodec/utils.c | 1 - libavformat/ffmenc.c | 2 +- 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/libavcodec/ratecontrol.c b/libavcodec/ratecontrol.c index d3bee6a457..e8d1ae8899 100644 --- a/libavcodec/ratecontrol.c +++ b/libavcodec/ratecontrol.c @@ -106,7 +106,7 @@ int ff_rate_control_init(MpegEncContext *s) }; emms_c(); - rcc->rc_eq_eval = ff_parse(s->avctx->rc_eq, const_names, func1, func1_names, NULL, NULL, &error); + rcc->rc_eq_eval = ff_parse(s->avctx->rc_eq ? s->avctx->rc_eq : "tex^qComp", const_names, func1, func1_names, NULL, NULL, &error); if (!rcc->rc_eq_eval) { av_log(s->avctx, AV_LOG_ERROR, "Error parsing rc_eq \"%s\": %s\n", s->avctx->rc_eq, error? error : ""); return -1; diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 750ab43bea..f25a672943 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -762,7 +762,6 @@ void avcodec_get_context_defaults2(AVCodecContext *s, enum CodecType codec_type) flags= AV_OPT_FLAG_SUBTITLE_PARAM; av_opt_set_defaults2(s, flags, flags); - s->rc_eq= av_strdup("tex^qComp"); s->time_base= (AVRational){0,1}; s->get_buffer= avcodec_default_get_buffer; s->release_buffer= avcodec_default_release_buffer; diff --git a/libavformat/ffmenc.c b/libavformat/ffmenc.c index d6cc8da5ce..80ec872553 100644 --- a/libavformat/ffmenc.c +++ b/libavformat/ffmenc.c @@ -132,7 +132,7 @@ static int ffm_write_header(AVFormatContext *s) put_be16(pb, (int) (codec->qcompress * 10000.0)); put_be16(pb, (int) (codec->qblur * 10000.0)); put_be32(pb, codec->bit_rate_tolerance); - put_strz(pb, codec->rc_eq); + put_strz(pb, codec->rc_eq ? codec->rc_eq : "tex^qComp"); put_be32(pb, codec->rc_max_rate); put_be32(pb, codec->rc_min_rate); put_be32(pb, codec->rc_buffer_size); -- cgit v1.2.3