diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c index 120e145a76..85abf2515b 100644 --- a/libavformat/bethsoftvid.c +++ b/libavformat/bethsoftvid.c @@ -189,6 +189,10 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt, if (vid->palette) { uint8_t *pdata = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, BVID_PALETTE_SIZE); + if (!pdata) { + ret = AVERROR(ENOMEM); + goto fail; + } memcpy(pdata, vid->palette, BVID_PALETTE_SIZE); av_freep(&vid->palette); }