From 482761b85a686c24dda18780a1c7e1e82c45e43c Mon Sep 17 00:00:00 2001
From: Michael Niedermayer <michaelni@gmx.at>
Date: Tue, 13 Jan 2015 15:02:36 +0100
Subject: [PATCH] avcodec/snowenc-test: check for av_malloc*() failures

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
---
 libavcodec/snowenc.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index cbc89c985bb..73b544a7345 100644
--- a/libavcodec/snowenc.c
+++ b/libavcodec/snowenc.c
@@ -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");
-- 
GitLab