Ticket #3996: patchdiracoom2.diff

File patchdiracoom2.diff, 1.1 KB (added by Carl Eugen Hoyos, 12 years ago)
  • libavcodec/dirac_parser.c

    diff --git a/libavcodec/dirac_parser.c b/libavcodec/dirac_parser.c
    index 4119e3b..8b7c55e 100644
    a b static int dirac_combine_frame(AVCodecParserContext *s, AVCodecContext *avctx,  
    139139        void *new_buffer =
    140140            av_fast_realloc(pc->buffer, &pc->buffer_size,
    141141                            pc->index + (*buf_size - pc->sync_offset));
     142        if (!new_buffer)
     143            return AVERROR(ENOMEM);
    142144        pc->buffer = new_buffer;
    143145        memcpy(pc->buffer + pc->index, (*buf + pc->sync_offset),
    144146               *buf_size - pc->sync_offset);
    … … static int dirac_combine_frame(AVCodecParserContext *s, AVCodecContext *avctx,  
    149151        DiracParseUnit pu1, pu;
    150152        void *new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size,
    151153                                           pc->index + next);
     154        if (!new_buffer)
     155            return AVERROR(ENOMEM);
    152156        pc->buffer = new_buffer;
    153157        memcpy(pc->buffer + pc->index, *buf, next);
    154158        pc->index += next;