[Mesa-dev] [PATCH 02/16] st_glsl_to_tgsi: use calloc the way it's meant to be used

Marek Olšák maraeo at gmail.com
Thu Aug 11 23:23:01 UTC 2016


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Wed, Aug 10, 2016 at 9:23 PM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> ---
>  src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> index 362559f..89e5c4d 100644
> --- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> +++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
> @@ -6031,21 +6031,21 @@ st_translate_program(
>        goto out;
>     }
>
>     t->procType = procType;
>     t->inputMapping = inputMapping;
>     t->outputMapping = outputMapping;
>     t->ureg = ureg;
>     t->num_temp_arrays = program->next_array;
>     if (t->num_temp_arrays)
>        t->arrays = (struct ureg_dst*)
> -                  calloc(1, sizeof(t->arrays[0]) * t->num_temp_arrays);
> +                  calloc(t->num_temp_arrays, sizeof(t->arrays[0]));
>
>     /*
>      * Declare input attributes.
>      */
>     switch (procType) {
>     case PIPE_SHADER_FRAGMENT:
>        for (i = 0; i < numInputs; i++) {
>           unsigned array_id = 0;
>           unsigned array_size;
>
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list