Commit a8605be3 authored by Michael Niedermayer's avatar Michael Niedermayer

Merge commit '84bf64d3'

* commit '84bf64d3':
  bethsoftvid: simplify return handling

See: 5ee6527cMerged-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parents a3b1e42e 84bf64d3
...@@ -180,7 +180,6 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt, ...@@ -180,7 +180,6 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt,
if ((ret = av_new_packet(pkt, vidbuf_nbytes)) < 0) if ((ret = av_new_packet(pkt, vidbuf_nbytes)) < 0)
goto fail; goto fail;
memcpy(pkt->data, vidbuf_start, vidbuf_nbytes); memcpy(pkt->data, vidbuf_start, vidbuf_nbytes);
av_free(vidbuf_start);
pkt->pos = position; pkt->pos = position;
pkt->stream_index = vid->video_index; pkt->stream_index = vid->video_index;
...@@ -192,16 +191,17 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt, ...@@ -192,16 +191,17 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt,
if (vid->palette) { if (vid->palette) {
uint8_t *pdata = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE, uint8_t *pdata = av_packet_new_side_data(pkt, AV_PKT_DATA_PALETTE,
BVID_PALETTE_SIZE); BVID_PALETTE_SIZE);
if (pdata) if (!pdata) {
memcpy(pdata, vid->palette, BVID_PALETTE_SIZE); ret = AVERROR(ENOMEM);
else
av_log(s, AV_LOG_ERROR, "Failed to allocate palette side data\n"); av_log(s, AV_LOG_ERROR, "Failed to allocate palette side data\n");
goto fail;
}
memcpy(pdata, vid->palette, BVID_PALETTE_SIZE);
av_freep(&vid->palette); av_freep(&vid->palette);
} }
vid->nframes--; // used to check if all the frames were read vid->nframes--; // used to check if all the frames were read
return 0;
fail: fail:
av_free(vidbuf_start); av_free(vidbuf_start);
return ret; return ret;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment