aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorPeter Ross <pross@xvid.org>2010-03-11 12:29:02 +0000
committerPeter Ross <pross@xvid.org>2010-03-11 12:29:02 +0000
commit70b462cc2940bce1023adb0780a83725526117f4 (patch)
treecb14ff88200780d669c599e4f752bc4bd446429f /libavformat
parent2b3da32f74ae03a08bf0d399eaf64917eb4f01a3 (diff)
downloadffmpeg-70b462cc2940bce1023adb0780a83725526117f4.tar.gz
Prevent memory leak introduced in r22389 in Bink demuxer: pass partial packets to decoder.
Originally committed as revision 22468 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/bink.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libavformat/bink.c b/libavformat/bink.c
index 3208d28465..ac04e762e8 100644
--- a/libavformat/bink.c
+++ b/libavformat/bink.c
@@ -212,15 +212,16 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
bink->current_track++;
if (audio_size >= 4) {
/* get one audio packet per track */
- if ((ret = av_get_packet(pb, pkt, audio_size)) != audio_size)
- return ret < 0 ? ret : AVERROR(EIO);;
+ if ((ret = av_get_packet(pb, pkt, audio_size)) < 0)
+ return ret;
pkt->stream_index = bink->current_track;
pkt->pts = bink->audio_pts[bink->current_track - 1];
/* Each audio packet reports the number of decompressed samples
(in bytes). We use this value to calcuate the audio PTS */
- bink->audio_pts[bink->current_track -1] +=
- AV_RL32(pkt->data) / (2 * s->streams[bink->current_track]->codec->channels);
+ if (pkt->size >= 4)
+ bink->audio_pts[bink->current_track -1] +=
+ AV_RL32(pkt->data) / (2 * s->streams[bink->current_track]->codec->channels);
return 0;
} else {
url_fseek(pb, audio_size, SEEK_CUR);
@@ -228,9 +229,8 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
}
/* get video packet */
- if ((ret = av_get_packet(pb, pkt, bink->remain_packet_size))
- != bink->remain_packet_size)
- return ret < 0 ? ret : AVERROR(EIO);
+ if ((ret = av_get_packet(pb, pkt, bink->remain_packet_size)) < 0)
+ return ret;
pkt->stream_index = 0;
pkt->pts = bink->video_pts++;
pkt->flags |= PKT_FLAG_KEY;