aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVitor Sessak <vitor1001@gmail.com>2010-03-02 21:32:29 +0000
committerVitor Sessak <vitor1001@gmail.com>2010-03-02 21:32:29 +0000
commit38beab19ab3b997bcbe2e95699d4952922f1f673 (patch)
treeaab7deb299198040638ee774ac12deef63151b2d
parentcbc4670c3792a742cffb9322c8bf405f51fc9f87 (diff)
downloadffmpeg-38beab19ab3b997bcbe2e95699d4952922f1f673.tar.gz
Plug some memory leaks for truncated files
Originally committed as revision 22153 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/r3d.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/libavformat/r3d.c b/libavformat/r3d.c
index 6909c73728..4f03d7f248 100644
--- a/libavformat/r3d.c
+++ b/libavformat/r3d.c
@@ -212,6 +212,7 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom)
int tmp, tmp2;
uint64_t pos = url_ftell(s->pb);
unsigned dts;
+ int ret;
dts = get_be32(s->pb);
@@ -243,8 +244,8 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom)
tmp = atom->size - 8 - (url_ftell(s->pb) - pos);
if (tmp < 0)
return -1;
-
- if (av_get_packet(s->pb, pkt, tmp) != tmp) {
+ ret = av_get_packet(s->pb, pkt, tmp);
+ if (ret < 0) {
av_log(s, AV_LOG_ERROR, "error reading video packet\n");
return -1;
}
@@ -265,6 +266,7 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom)
int tmp, tmp2, samples, size;
uint64_t pos = url_ftell(s->pb);
unsigned dts;
+ int ret;
dts = get_be32(s->pb);
@@ -288,9 +290,10 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom)
size = atom->size - 8 - (url_ftell(s->pb) - pos);
if (size < 0)
return -1;
- if (av_get_packet(s->pb, pkt, size) != size) {
- av_log(s, AV_LOG_ERROR, "error reading video packet\n");
- return -1;
+ ret = av_get_packet(s->pb, pkt, size);
+ if (ret < 0) {
+ av_log(s, AV_LOG_ERROR, "error reading audio packet\n");
+ return ret;
}
pkt->stream_index = 1;