[Mesa-dev] [PATCH 2/3] r600/llvm: Free binary.code/binary.config in r600_llvm_compile

Tom Stellard tom at stellard.net
Mon Nov 11 15:37:58 PST 2013


On Thu, Nov 07, 2013 at 06:08:15PM -0600, Aaron Watry wrote:
> radeon_llvm_compile allocates memory for binary.code, binary.config, or neither depending on
> what's being done.
> 
> We need to make sure to free that memory after it's no longer needed.
> ---
>  src/gallium/drivers/r600/r600_llvm.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/src/gallium/drivers/r600/r600_llvm.c b/src/gallium/drivers/r600/r600_llvm.c
> index f52ae84..084ba2a 100644
> --- a/src/gallium/drivers/r600/r600_llvm.c
> +++ b/src/gallium/drivers/r600/r600_llvm.c
> @@ -745,6 +745,13 @@ unsigned r600_llvm_compile(
>  		}
>  	}
>  
> +	if (binary.code){
> +		FREE(binary.code);
> +	}
> +	if (binary.config){
> +		FREE(binary.config);
> +	}
> +

You don't need to check for NULL here.   FREE accepts NULL pointers.

-Tom

>  	return r;
>  }
>  
> -- 
> 1.8.3.2
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list