avformat/sbgdec: Check alloc_array_elem() return value
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 2 Jun 2015 12:58:20 +0000 (14:58 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 2 Jun 2015 14:42:33 +0000 (16:42 +0200)
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/sbgdec.c

index 23b7ea4..03cd922 100644 (file)
@@ -973,6 +973,8 @@ static int expand_tseq(void *log, struct sbg_script *s, int *nb_ev_max,
     } else {
         ev = alloc_array_elem((void **)&s->events, sizeof(*ev),
                               &s->nb_events, nb_ev_max);
+        if (!ev)
+            return AVERROR(ENOMEM);
         ev->ts          = tseq->ts.t;
         ev->elements    = def->elements;
         ev->nb_elements = def->nb_elements;