[FFmpeg-cvslog] avutil/pixelutils: check for malloc failure

Michael Niedermayer git at videolan.org
Wed Aug 6 01:56:47 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Wed Aug  6 01:45:29 2014 +0200| [6552b0558a15b05c49976b393f2d3123c317df3a] | committer: Michael Niedermayer

avutil/pixelutils: check for malloc failure

Found-by: Daemon404
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6552b0558a15b05c49976b393f2d3123c317df3a
---

 libavutil/pixelutils.c |    6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libavutil/pixelutils.c b/libavutil/pixelutils.c
index ca424d8..10ff7e8 100644
--- a/libavutil/pixelutils.c
+++ b/libavutil/pixelutils.c
@@ -128,6 +128,12 @@ int main(void)
     uint8_t *buf2 = av_malloc(W2*H2);
     uint32_t state = 0;
 
+    if (!buf1 || !buf2) {
+        fprintf(stderr, "malloc failure\n");
+        ret = 1;
+        goto end;
+    }
+
     for (i = 0; i < W1*H1; i++) {
         state = state * 1664525 + 1013904223;
         buf1[i] = state>>24;



More information about the ffmpeg-cvslog mailing list