[Mesa-dev] [PATCH 3/3] radeon/llvm: Free elf_buffer after use

Tom Stellard tom at stellard.net
Mon Nov 11 15:41:20 PST 2013


On Thu, Nov 07, 2013 at 06:08:16PM -0600, Aaron Watry wrote:
> Prevents a memory leak.
> ---
>  src/gallium/drivers/radeon/radeon_llvm_emit.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/src/gallium/drivers/radeon/radeon_llvm_emit.c b/src/gallium/drivers/radeon/radeon_llvm_emit.c
> index d2e5642..e35c212 100644
> --- a/src/gallium/drivers/radeon/radeon_llvm_emit.c
> +++ b/src/gallium/drivers/radeon/radeon_llvm_emit.c
> @@ -176,6 +176,9 @@ unsigned radeon_llvm_compile(LLVMModuleRef M, struct radeon_llvm_binary *binary,
>  	if (elf){
>  		elf_end(elf);
>  	}
> +	if (elf_buffer){
> +		FREE(elf_buffer);
> +	}

We don't need the NULL check here either.

-Tom

>  	LLVMDisposeMemoryBuffer(out_buffer);
>  	LLVMDisposeTargetMachine(tm);
>  	return 0;
> -- 
> 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