]> git.sesse.net Git - ffmpeg/commitdiff
avfilter/vf_lensfun: use av_malloc_array()
authorPaul B Mahol <onemda@gmail.com>
Thu, 18 Oct 2018 09:36:20 +0000 (11:36 +0200)
committerPaul B Mahol <onemda@gmail.com>
Thu, 18 Oct 2018 09:36:20 +0000 (11:36 +0200)
libavfilter/vf_lensfun.c

index 5cc98020d13c582e3ed4692ddd6eaf48bfe96a1f..901cd9ff90b1e4c98c6206d4ee8d8feaffedd95c 100644 (file)
@@ -240,7 +240,7 @@ static int config_props(AVFilterLink *inlink)
 
     if (!lensfun->distortion_coords) {
         if (lensfun->mode & SUBPIXEL_DISTORTION) {
-            lensfun->distortion_coords = av_malloc(sizeof(float) * inlink->w * inlink->h * 2 * 3);
+            lensfun->distortion_coords = av_malloc_array(inlink->w * inlink->h, sizeof(float) * 2 * 3);
             if (!lensfun->distortion_coords)
                 return AVERROR(ENOMEM);
             if (lensfun->mode & GEOMETRY_DISTORTION) {
@@ -257,7 +257,7 @@ static int config_props(AVFilterLink *inlink)
                                                       lensfun->distortion_coords);
             }
         } else if (lensfun->mode & GEOMETRY_DISTORTION) {
-            lensfun->distortion_coords = av_malloc(sizeof(float) * inlink->w * inlink->h * 2);
+            lensfun->distortion_coords = av_malloc_array(inlink->w * inlink->h, sizeof(float) * 2);
             if (!lensfun->distortion_coords)
                 return AVERROR(ENOMEM);
             // apply only geometry distortion
@@ -270,7 +270,7 @@ static int config_props(AVFilterLink *inlink)
 
     if (!lensfun->interpolation)
         if (lensfun->interpolation_type == LANCZOS) {
-            lensfun->interpolation = av_malloc(sizeof(float) * 4 * LANCZOS_RESOLUTION);
+            lensfun->interpolation = av_malloc_array(LANCZOS_RESOLUTION, sizeof(float) * 4);
             if (!lensfun->interpolation)
                 return AVERROR(ENOMEM);
             for (index = 0; index < 4 * LANCZOS_RESOLUTION; ++index) {