avfilter/vf_drawtext: fix resource leaks
Fixes CID1206649 Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
66e30a2e65
commit
6956b048d8
@ -457,6 +457,7 @@ static int load_textfile(AVFilterContext *ctx)
|
|||||||
DrawTextContext *s = ctx->priv;
|
DrawTextContext *s = ctx->priv;
|
||||||
int err;
|
int err;
|
||||||
uint8_t *textbuf;
|
uint8_t *textbuf;
|
||||||
|
uint8_t *tmp;
|
||||||
size_t textbuf_size;
|
size_t textbuf_size;
|
||||||
|
|
||||||
if ((err = av_file_map(s->textfile, &textbuf, &textbuf_size, 0, ctx)) < 0) {
|
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;
|
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);
|
return AVERROR(ENOMEM);
|
||||||
|
}
|
||||||
|
s->text = tmp;
|
||||||
memcpy(s->text, textbuf, textbuf_size);
|
memcpy(s->text, textbuf, textbuf_size);
|
||||||
s->text[textbuf_size] = 0;
|
s->text[textbuf_size] = 0;
|
||||||
av_file_unmap(textbuf, textbuf_size);
|
av_file_unmap(textbuf, textbuf_size);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user