Commit 339ccbaf authored by vitor's avatar vitor

Plug some memory leaks for truncated files


git-svn-id: file:///var/local/repositories/ffmpeg/trunk@22153 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b
parent 071fafcf
...@@ -212,6 +212,7 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom) ...@@ -212,6 +212,7 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom)
int tmp, tmp2; int tmp, tmp2;
uint64_t pos = url_ftell(s->pb); uint64_t pos = url_ftell(s->pb);
unsigned dts; unsigned dts;
int ret;
dts = get_be32(s->pb); dts = get_be32(s->pb);
...@@ -243,8 +244,8 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom) ...@@ -243,8 +244,8 @@ static int r3d_read_redv(AVFormatContext *s, AVPacket *pkt, Atom *atom)
tmp = atom->size - 8 - (url_ftell(s->pb) - pos); tmp = atom->size - 8 - (url_ftell(s->pb) - pos);
if (tmp < 0) if (tmp < 0)
return -1; return -1;
ret = av_get_packet(s->pb, pkt, tmp);
if (av_get_packet(s->pb, pkt, tmp) != tmp) { if (ret < 0) {
av_log(s, AV_LOG_ERROR, "error reading video packet\n"); av_log(s, AV_LOG_ERROR, "error reading video packet\n");
return -1; return -1;
} }
...@@ -265,6 +266,7 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom) ...@@ -265,6 +266,7 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom)
int tmp, tmp2, samples, size; int tmp, tmp2, samples, size;
uint64_t pos = url_ftell(s->pb); uint64_t pos = url_ftell(s->pb);
unsigned dts; unsigned dts;
int ret;
dts = get_be32(s->pb); dts = get_be32(s->pb);
...@@ -288,9 +290,10 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom) ...@@ -288,9 +290,10 @@ static int r3d_read_reda(AVFormatContext *s, AVPacket *pkt, Atom *atom)
size = atom->size - 8 - (url_ftell(s->pb) - pos); size = atom->size - 8 - (url_ftell(s->pb) - pos);
if (size < 0) if (size < 0)
return -1; return -1;
if (av_get_packet(s->pb, pkt, size) != size) { ret = av_get_packet(s->pb, pkt, size);
av_log(s, AV_LOG_ERROR, "error reading video packet\n"); if (ret < 0) {
return -1; av_log(s, AV_LOG_ERROR, "error reading audio packet\n");
return ret;
} }
pkt->stream_index = 1; pkt->stream_index = 1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment