[libav-stable] bethsoftvid: check return value and clean memory

Vittorio Giovara git at libav.org
Mon Oct 27 20:12:26 CET 2014


Module: libav
Branch: master
Commit: e6c66f1e4ea19a3aa6ed999c5cb92e1b682c7600

Author:    Vittorio Giovara <vittorio.giovara at gmail.com>
Committer: Vittorio Giovara <vittorio.giovara at gmail.com>
Date:      Fri Oct 24 13:15:34 2014 +0100

bethsoftvid: check return value and clean memory

CC: libav-stable at libav.org
Bug-Id: CID 733777

---

 libavformat/bethsoftvid.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c
index 120e145..85abf25 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);
     }



More information about the libav-stable mailing list