avcodec/snowenc-test: check for av_malloc*() failures
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 13 Jan 2015 14:02:36 +0000 (15:02 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 13 Jan 2015 14:02:36 +0000 (15:02 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/snowenc.c

index cbc89c985bb81e62cfcfa6619802de9a8405937d..73b544a734569bc9a5cc645a11f8521b19a3c67e 100644 (file)
@@ -1922,6 +1922,11 @@ int main(void){
     s.temp_dwt_buffer  = av_mallocz(width * sizeof(DWTELEM));
     s.temp_idwt_buffer = av_mallocz(width * sizeof(IDWTELEM));
 
+    if (!s.temp_dwt_buffer || !s.temp_idwt_buffer) {
+        fprintf(stderr, "Failed to allocate memory\n");
+        return 1;
+    }
+
     av_lfg_init(&prng, 1);
 
     printf("testing 5/3 DWT\n");