summaryrefslogtreecommitdiffstats
path: root/libavfilter/vf_drawtext.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-04-27 01:54:32 +0200
committerMichael Niedermayer <michaelni@gmx.at>2014-04-27 03:18:57 +0200
commit6956b048d8198dce5126c8942dece21cfb1a7978 (patch)
treee7738363227d86f95b2c302b403899bf91f3a5b5 /libavfilter/vf_drawtext.c
parent66e30a2e65e81a5abb9149fe8587355273cbb38f (diff)
downloadffmpeg-streaming-6956b048d8198dce5126c8942dece21cfb1a7978.zip
ffmpeg-streaming-6956b048d8198dce5126c8942dece21cfb1a7978.tar.gz
avfilter/vf_drawtext: fix resource leaks
Fixes CID1206649 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/vf_drawtext.c')
-rw-r--r--libavfilter/vf_drawtext.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c
index 280abb8..f7486c9 100644
--- a/libavfilter/vf_drawtext.c
+++ b/libavfilter/vf_drawtext.c
@@ -457,6 +457,7 @@ static int load_textfile(AVFilterContext *ctx)
DrawTextContext *s = ctx->priv;
int err;
uint8_t *textbuf;
+ uint8_t *tmp;
size_t textbuf_size;
if ((err = av_file_map(s->textfile, &textbuf, &textbuf_size, 0, ctx)) < 0) {
@@ -466,8 +467,11 @@ static int load_textfile(AVFilterContext *ctx)
return err;
}
- if (!(s->text = av_realloc(s->text, textbuf_size + 1)))
+ if (!(tmp = av_realloc(s->text, textbuf_size + 1))) {
+ av_file_unmap(textbuf, textbuf_size);
return AVERROR(ENOMEM);
+ }
+ s->text = tmp;
memcpy(s->text, textbuf, textbuf_size);
s->text[textbuf_size] = 0;
av_file_unmap(textbuf, textbuf_size);
OpenPOWER on IntegriCloud