aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2007-04-07 22:47:55 +0000
committerMichael Niedermayer <michaelni@gmx.at>2007-04-07 22:47:55 +0000
commit373209f81684c4a715a7a7b91281924105bb4ea8 (patch)
tree1934ebefc6fddb260f554c191badea097546129d
parentd5c5c8b4d3263de5ade7c9e6c64ab58de899bab9 (diff)
downloadffmpeg-373209f81684c4a715a7a7b91281924105bb4ea8.tar.gz
memleak (seems ive missed that under the obfuscated indention)
Originally committed as revision 8659 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/bethsoftvid.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/libavformat/bethsoftvid.c b/libavformat/bethsoftvid.c
index 0aaac3c1b8..63306acb32 100644
--- a/libavformat/bethsoftvid.c
+++ b/libavformat/bethsoftvid.c
@@ -124,7 +124,7 @@ static int read_frame(BVID_DemuxContext *vid, ByteIOContext *pb, AVPacket *pkt,
// set the y offset if it exists (decoder header data should be in data section)
if(block_type == VIDEO_YOFFSET_DIFFERENCE_FRAME_BLOCK){
if(get_buffer(pb, &vidbuf_start[vidbuf_nbytes], 2) != 2)
- return AVERROR_IO;
+ goto fail;
vidbuf_nbytes += 2;
}
@@ -142,7 +142,7 @@ static int read_frame(BVID_DemuxContext *vid, ByteIOContext *pb, AVPacket *pkt,
bytes_copied += rle_num_bytes - 0x80;
} else if(rle_num_bytes){ // plain sequence
if(get_buffer(pb, &vidbuf_start[vidbuf_nbytes], rle_num_bytes) != rle_num_bytes)
- return AVERROR_IO;
+ goto fail;
vidbuf_nbytes += rle_num_bytes;
bytes_copied += rle_num_bytes;
}
@@ -153,12 +153,12 @@ static int read_frame(BVID_DemuxContext *vid, ByteIOContext *pb, AVPacket *pkt,
break;
}
if(bytes_copied > npixels)
- return -1; // error
+ goto fail;
} while(rle_num_bytes);
// copy data into packet
- if(av_new_packet(pkt, vidbuf_nbytes))
- return AVERROR_NOMEM;
+ if(av_new_packet(pkt, vidbuf_nbytes) < 0)
+ goto fail;
memcpy(pkt->data, vidbuf_start, vidbuf_nbytes);
av_free(vidbuf_start);
@@ -168,6 +168,9 @@ static int read_frame(BVID_DemuxContext *vid, ByteIOContext *pb, AVPacket *pkt,
vid->nframes--; // used to check if all the frames were read
return vidbuf_nbytes;
+fail:
+ av_free(vidbuf_start);
+ return -1;
}
static int vid_read_packet(AVFormatContext *s,