Commit 2d9c290a authored by Paul B Mahol's avatar Paul B Mahol

avfilter/vf_lensfun: use av_malloc_array()

parent 0ce7005d
...@@ -240,7 +240,7 @@ static int config_props(AVFilterLink *inlink) ...@@ -240,7 +240,7 @@ static int config_props(AVFilterLink *inlink)
if (!lensfun->distortion_coords) { if (!lensfun->distortion_coords) {
if (lensfun->mode & SUBPIXEL_DISTORTION) { 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) if (!lensfun->distortion_coords)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
if (lensfun->mode & GEOMETRY_DISTORTION) { if (lensfun->mode & GEOMETRY_DISTORTION) {
...@@ -257,7 +257,7 @@ static int config_props(AVFilterLink *inlink) ...@@ -257,7 +257,7 @@ static int config_props(AVFilterLink *inlink)
lensfun->distortion_coords); lensfun->distortion_coords);
} }
} else if (lensfun->mode & GEOMETRY_DISTORTION) { } 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) if (!lensfun->distortion_coords)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
// apply only geometry distortion // apply only geometry distortion
...@@ -270,7 +270,7 @@ static int config_props(AVFilterLink *inlink) ...@@ -270,7 +270,7 @@ static int config_props(AVFilterLink *inlink)
if (!lensfun->interpolation) if (!lensfun->interpolation)
if (lensfun->interpolation_type == LANCZOS) { 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) if (!lensfun->interpolation)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
for (index = 0; index < 4 * LANCZOS_RESOLUTION; ++index) { for (index = 0; index < 4 * LANCZOS_RESOLUTION; ++index) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment