avutil/pixelutils: check for malloc failure

Found-by: Daemon404
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2014-08-06 01:45:29 +02:00
parent 84ac2f93ca
commit 6552b0558a

View File

@ -128,6 +128,12 @@ int main(void)
uint8_t *buf2 = av_malloc(W2*H2); uint8_t *buf2 = av_malloc(W2*H2);
uint32_t state = 0; uint32_t state = 0;
if (!buf1 || !buf2) {
fprintf(stderr, "malloc failure\n");
ret = 1;
goto end;
}
for (i = 0; i < W1*H1; i++) { for (i = 0; i < W1*H1; i++) {
state = state * 1664525 + 1013904223; state = state * 1664525 + 1013904223;
buf1[i] = state>>24; buf1[i] = state>>24;