[FFmpeg-cvslog] avcodec/snowenc-test: check for av_malloc*() failures

Michael Niedermayer git at videolan.org
Tue Jan 13 16:34:55 CET 2015


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Jan 13 15:02:36 2015 +0100| [482761b85a686c24dda18780a1c7e1e82c45e43c] | committer: Michael Niedermayer

avcodec/snowenc-test: check for av_malloc*() failures

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

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

 libavcodec/snowenc.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/snowenc.c b/libavcodec/snowenc.c
index cbc89c9..73b544a 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");



More information about the ffmpeg-cvslog mailing list