avutil/pixelutils: check for malloc failure
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 5 Aug 2014 23:45:29 +0000 (01:45 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 5 Aug 2014 23:45:29 +0000 (01:45 +0200)
Found-by: Daemon404
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavutil/pixelutils.c

index ca424d8..10ff7e8 100644 (file)
@@ -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;