summaryrefslogtreecommitdiff
path: root/libavcodec/dvbsubdec.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2017-11-06 18:46:05 -0300
committerJames Almer <jamrial@gmail.com>2017-11-06 18:46:05 -0300
commit7d1c79f533e0c80cbcda60d3cbd8216551a1bac5 (patch)
tree2268dc789039520d60cbdc0160ad539f0a60fec0 /libavcodec/dvbsubdec.c
parenta82a10e08f5d4f206e1e6781653d75f82d3de6c6 (diff)
parenta594f17f83a1ffdc1eec18818208fe39487dd5d7 (diff)
Merge commit 'a594f17f83a1ffdc1eec18818208fe39487dd5d7'
* commit 'a594f17f83a1ffdc1eec18818208fe39487dd5d7': dvbsubdec: Free subrect memory on allocation error dvbsubdec: Fixed segfault when decoding subtitles See fbb59a3bf4c8668197521b3db5f26d0e93aed1a6 39dfe6801a3f67c2964a829b65e8e38e3cb22217 Merged-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/dvbsubdec.c')
-rw-r--r--libavcodec/dvbsubdec.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c
index 85a59f3ced..4e08dba35c 100644
--- a/libavcodec/dvbsubdec.c
+++ b/libavcodec/dvbsubdec.c
@@ -753,8 +753,13 @@ static int save_subtitle_set(AVCodecContext *avctx, AVSubtitle *sub, int *got_ou
goto fail;
}
- for(i=0; i<sub->num_rects; i++)
+ for (i = 0; i < sub->num_rects; i++) {
sub->rects[i] = av_mallocz(sizeof(*sub->rects[i]));
+ if (!sub->rects[i]) {
+ ret = AVERROR(ENOMEM);
+ goto fail;
+ }
+ }
i = 0;