[FFmpeg-devel] [PATCH] Check malloc values in swscale.

Ramiro Polla ramiro.polla
Fri Aug 14 03:11:45 CEST 2009



Am I being overparanoid cleaning up all previously allocated blocks
before leaving the function, like in:
         for (i=0; i<c->vLumBufSize; i++)
+        {
             c->alpPixBuf[i]= c->alpPixBuf[i+c->vLumBufSize]= av_mallocz(VOF+1);
+            if (!c->alpPixBuf[i]) {
+                for (; i >= 0; i--)
+                    av_free(c->alpPixBuf[i]);
+                return NULL;
+            }
+        }

Is ok to just return NULL and leave those previous blocks there?

Ramiro Polla
-------------- next part --------------
A non-text attachment was scrubbed...
Name: malloc_error.diff
Type: text/x-diff
Size: 9513 bytes
Desc: not available
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090813/74f450e7/attachment.diff>

More information about the ffmpeg-devel mailing list