avcodec/evc_frame_merge_bsf: check for av_memdup() failure

Signed-off-by: James Almer <jamrial@gmail.com>
This commit is contained in:
James Almer 2023-06-15 11:35:22 -03:00
parent 9fc1d9adc8
commit b1d0b59d81
1 changed files with 6 additions and 1 deletions

View File

@ -61,6 +61,7 @@ static void evc_frame_merge_flush(AVBSFContext *bsf)
EVCFMergeContext *ctx = bsf->priv_data;
av_packet_unref(ctx->in);
ctx->au_buffer.data_size = 0;
}
static int evc_frame_merge_filter(AVBSFContext *bsf, AVPacket *out)
@ -117,9 +118,13 @@ static int evc_frame_merge_filter(AVBSFContext *bsf, AVPacket *out)
if (au_end_found) {
uint8_t *data = av_memdup(ctx->au_buffer.data, ctx->au_buffer.data_size);
err = av_packet_from_data(out, data, ctx->au_buffer.data_size);
size_t data_size = ctx->au_buffer.data_size;
ctx->au_buffer.data_size = 0;
if (!data)
return AVERROR(ENOMEM);
err = av_packet_from_data(out, data, data_size);
} else
err = AVERROR(EAGAIN);