Browse code

Check for memory allocation failure of temp buffer

Originally committed as revision 11053 to svn://svn.ffmpeg.org/ffmpeg/trunk

Roberto Togni authored on 2007/11/19 07:49:41
Showing 1 changed files
... ...
@@ -495,7 +495,8 @@ static int rm_assemble_video_frame(AVFormatContext *s, RMContext *rm, AVPacket *
495 495
     if((seq & 0x7F) == 1 || rm->curpic_num != pic_num){
496 496
         rm->slices = ((hdr & 0x3F) << 1) + 1;
497 497
         ssize = len2 + 8*rm->slices + 1;
498
-        rm->videobuf = av_realloc(rm->videobuf, ssize);
498
+        if(!(rm->videobuf = av_realloc(rm->videobuf, ssize)))
499
+            return AVERROR(ENOMEM);
499 500
         rm->videobufsize = ssize;
500 501
         rm->videobufpos = 8*rm->slices + 1;
501 502
         rm->cur_slice = 0;