Skip to content

Commit

Permalink
avcodec/extract_extradata: return an error when buffer allocation fails
Browse files Browse the repository at this point in the history
ret is 0 by default.

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: James Almer <jamrial@gmail.com>
  • Loading branch information
jamrial committed Sep 13, 2017
1 parent 4d39034 commit 7bae17e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion libavcodec/extract_extradata_bsf.c
Expand Up @@ -101,14 +101,17 @@ static int extract_extradata_h2645(AVBSFContext *ctx, AVPacket *pkt,

if (s->remove) {
filtered_buf = av_buffer_alloc(pkt->size + AV_INPUT_BUFFER_PADDING_SIZE);
if (!filtered_buf)
if (!filtered_buf) {
ret = AVERROR(ENOMEM);
goto fail;
}
filtered_data = filtered_buf->data;
}

extradata = av_malloc(extradata_size + AV_INPUT_BUFFER_PADDING_SIZE);
if (!extradata) {
av_buffer_unref(&filtered_buf);
ret = AVERROR(ENOMEM);
goto fail;
}

Expand Down

0 comments on commit 7bae17e

Please sign in to comment.