avcodec/msrleenc: Check allocation

Fixes Coverity issue #1538297.

Reviewed-by: Tomas Härdin <git@haerdin.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
This commit is contained in:
Andreas Rheinhardt 2023-07-16 16:30:08 +02:00
parent a054ceb4e2
commit 3c642af8e0
1 changed files with 2 additions and 0 deletions

View File

@ -250,6 +250,8 @@ static int msrle_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
if (pict->data[1]) { if (pict->data[1]) {
uint8_t *side_data = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE); uint8_t *side_data = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, AVPALETTE_SIZE);
if (!side_data)
return AVERROR(ENOMEM);
memcpy(side_data, pict->data[1], AVPALETTE_SIZE); memcpy(side_data, pict->data[1], AVPALETTE_SIZE);
} }