summaryrefslogtreecommitdiff
path: root/libavcodec/utils.c
diff options
context:
space:
mode:
authorAurelien Jacobs <aurel@gnuage.org>2010-12-31 00:06:25 +0000
committerAurelien Jacobs <aurel@gnuage.org>2010-12-31 00:06:25 +0000
commitf19c58b4cf0be11cdcfa609ca78265e4b4206091 (patch)
tree3edff8ec78bedde807f2690f6b744b00694834ba /libavcodec/utils.c
parent1d6233d315dc0af552b16e5b4d14084fbeb9fbb5 (diff)
free subtitle_header before overwriting it to avoid memleak
Originally committed as revision 26176 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r--libavcodec/utils.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c
index d82f589181..ce7473587e 100644
--- a/libavcodec/utils.c
+++ b/libavcodec/utils.c
@@ -505,6 +505,11 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec)
avcodec_set_dimensions(avctx, 0, 0);
}
+ /* if the decoder init function was already called previously,
+ free the already allocated subtitle_header before overwriting it */
+ if (codec->decode)
+ av_freep(&avctx->subtitle_header);
+
#define SANE_NB_CHANNELS 128U
if (avctx->channels > SANE_NB_CHANNELS) {
ret = AVERROR(EINVAL);