Skip to content
Snippets Groups Projects
Commit 2813dabd authored by Michael Niedermayer's avatar Michael Niedermayer
Browse files

avcodec/dvbsubdec: use av_freep() for saftey

parent 4809ac75
No related branches found
No related tags found
No related merge requests found
...@@ -842,15 +842,15 @@ static int save_subtitle_set(AVCodecContext *avctx, AVSubtitle *sub, int *got_ou ...@@ -842,15 +842,15 @@ static int save_subtitle_set(AVCodecContext *avctx, AVSubtitle *sub, int *got_ou
rect->pict.data[1] = av_mallocz(AVPALETTE_SIZE); rect->pict.data[1] = av_mallocz(AVPALETTE_SIZE);
if (!rect->pict.data[1]) { if (!rect->pict.data[1]) {
av_free(sub->rects); av_freep(&sub->rects);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
memcpy(rect->pict.data[1], clut_table, (1 << region->depth) * sizeof(uint32_t)); memcpy(rect->pict.data[1], clut_table, (1 << region->depth) * sizeof(uint32_t));
rect->pict.data[0] = av_malloc(region->buf_size); rect->pict.data[0] = av_malloc(region->buf_size);
if (!rect->pict.data[0]) { if (!rect->pict.data[0]) {
av_free(rect->pict.data[1]); av_freep(&rect->pict.data[1]);
av_free(sub->rects); av_freep(&sub->rects);
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment