[Mesa-dev] [PATCH mesa] util/ra: fix memory leak

Nicolai Hähnle nhaehnle at gmail.com
Mon Jul 31 10:07:37 UTC 2017


On 30.07.2017 00:53, Eric Engestrom wrote:
> CID: 1415909
> Fixes: 7a34a0e8903249c41fae "ra: Add a callback for selecting a register
>                               from what's available."
> Signed-off-by: Eric Engestrom <eric at engestrom.ch>
> ---
>   src/util/register_allocate.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/src/util/register_allocate.c b/src/util/register_allocate.c
> index b06a61f24a..f6475b6b93 100644
> --- a/src/util/register_allocate.c
> +++ b/src/util/register_allocate.c
> @@ -638,6 +638,7 @@ ra_select(struct ra_graph *g)
>            }
>   
>            r = g->select_reg_callback(g, select_regs, g->select_reg_callback_data);
> +         free(select_regs);

I don't think this is correct, as the whole thing executes in a loop.

Please put this at the end of the function (no guard necessary).

Cheers,
Nicolai


>         } else {
>            /* Find the lowest-numbered reg which is not used by a member
>             * of the graph adjacent to us.
> 


-- 
Lerne, wie die Welt wirklich ist,
Aber vergiss niemals, wie sie sein sollte.


More information about the mesa-dev mailing list