[FFmpeg-cvslog] r22153 - trunk/libavformat/r3d.c

vitor subversion
Tue Mar 2 22:32:29 CET 2010


Author: vitor
Date: Tue Mar  2 22:32:29 2010
New Revision: 22153

Log:
Plug some memory leaks for truncated files

Modified:
   trunk/libavformat/r3d.c

Modified: trunk/libavformat/r3d.c
==============================================================================
--- trunk/libavformat/r3d.c	Tue Mar  2 18:50:24 2010	(r22152)
+++ trunk/libavformat/r3d.c	Tue Mar  2 22:32:29 2010	(r22153)
@@ -212,6 +212,7 @@ static int r3d_read_redv(AVFormatContext
     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
     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
     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
     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;



More information about the ffmpeg-cvslog mailing list