]> git.sesse.net Git - ffmpeg/blobdiff - libpostproc/postprocess.c
Merge commit 'e570f895cdccf2535a71fec1c607751ddb94fd5a'
[ffmpeg] / libpostproc / postprocess.c
index c11debcd7049614972f49533f08e80d22ae9ed1e..4d54c6dc89bbea3a9c60a83f8386b4b9b7178d7f 100644 (file)
@@ -700,6 +700,8 @@ pp_mode *pp_get_mode_by_name_and_quality(const char *name, int quality)
     }
 
     ppMode= av_malloc(sizeof(PPMode));
+    if (!ppMode)
+        return NULL;
 
     ppMode->lumMode= 0;
     ppMode->chromMode= 0;
@@ -913,11 +915,13 @@ static const char * context_to_name(void * ptr) {
 static const AVClass av_codec_context_class = { "Postproc", context_to_name, NULL };
 
 pp_context *pp_get_context(int width, int height, int cpuCaps){
-    PPContext *c= av_malloc(sizeof(PPContext));
+    PPContext *c= av_mallocz(sizeof(PPContext));
     int stride= FFALIGN(width, 16);  //assumed / will realloc if needed
     int qpStride= (width+15)/16 + 2; //assumed / will realloc if needed
 
-    memset(c, 0, sizeof(PPContext));
+    if (!c)
+        return NULL;
+
     c->av_class = &av_codec_context_class;
     if(cpuCaps&PP_FORMAT){
         c->hChromaSubSample= cpuCaps&0x3;