diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-10-30 00:21:49 +0300 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-10-30 00:47:11 +0300 |
commit | a8605be30fddc48ac043a4bd56841bc1f004a9c5 (patch) | |
tree | 2f07c68cf3cf189874eccce5acc736084b0c92f3 /libavformat/bethsoftvid.c | |
parent | a3b1e42ec4f44c4d67a6efcf6f65527b2c952432 (diff) | |
parent | 84bf64d3598c98a748e609195358ea04b0cfd140 (diff) |
Merge commit '84bf64d3598c98a748e609195358ea04b0cfd140'
* commit '84bf64d3598c98a748e609195358ea04b0cfd140':
bethsoftvid: simplify return handling
See: 5ee6527c4386c76a0aae1b07842d6676ee1e91d1
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/bethsoftvid.c')
-rw-r--r-- | libavformat/bethsoftvid.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c index 05f5c4f822..40a425271d 100644 --- a/libavformat/bethsoftvid.c +++ b/libavformat/bethsoftvid.c @@ -180,7 +180,6 @@ static int read_frame(BVID_DemuxContext *vid, AVIOContext *pb, AVPacket *pkt, if ((ret = av_new_packet(pkt, vidbuf_nbytes)) < 0) goto fail; memcpy(pkt->data, vidbuf_start, vidbuf_nbytes); - av_free(vidbuf_start); pkt->pos = position; pkt->stream_index = vid->video_index; @@ -192,16 +191,17 @@ 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) - memcpy(pdata, vid->palette, BVID_PALETTE_SIZE); - else + if (!pdata) { + ret = AVERROR(ENOMEM); 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); } vid->nframes--; // used to check if all the frames were read - return 0; fail: av_free(vidbuf_start); return ret; |