[vlc-commits] video_filter: hqdn3d: handle alloc failures

Francois Cartegnie git at videolan.org
Thu Dec 31 18:01:14 CET 2015


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Thu Dec 31 16:51:48 2015 +0100| [45a8c2abd25a67693e639e740128fb5e398799a4] | committer: Francois Cartegnie

video_filter: hqdn3d: handle alloc failures

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=45a8c2abd25a67693e639e740128fb5e398799a4
---

 modules/video_filter/hqdn3d.c |    7 +++++++
 modules/video_filter/hqdn3d.h |    2 ++
 2 files changed, 9 insertions(+)

diff --git a/modules/video_filter/hqdn3d.c b/modules/video_filter/hqdn3d.c
index 7b63bde..4d48a96 100644
--- a/modules/video_filter/hqdn3d.c
+++ b/modules/video_filter/hqdn3d.c
@@ -245,6 +245,13 @@ static picture_t *Filter(filter_t *filter, picture_t *src)
             cfg->Coefs[2],
             cfg->Coefs[3]);
 
+    if(unlikely(!cfg->Frame[0] || !cfg->Frame[1] || !cfg->Frame[2]))
+    {
+        picture_Release( src );
+        picture_Release( dst );
+        return NULL;
+    }
+
     return CopyInfoAndRelease(dst, src);
 }
 
diff --git a/modules/video_filter/hqdn3d.h b/modules/video_filter/hqdn3d.h
index 4b02a0a..c9b9bea 100644
--- a/modules/video_filter/hqdn3d.h
+++ b/modules/video_filter/hqdn3d.h
@@ -120,6 +120,8 @@ static void deNoise(unsigned char *Frame,        // mpi->planes[x]
 
     if(!FrameAnt){
         (*FrameAntPtr)=FrameAnt=malloc(W*H*sizeof(unsigned short));
+        if(!FrameAnt)
+            return;
         for (long Y = 0; Y < H; Y++){
             unsigned short* dst=&FrameAnt[Y*W];
             unsigned char* src=Frame+Y*sStride;



More information about the vlc-commits mailing list