[PATCH] [s3] CID 1414774: resource leak in cli_dfs_get_referral_ex

Jeremy Allison jra at samba.org
Thu Jun 14 22:45:30 UTC 2018


On Thu, Jun 14, 2018 at 09:27:50AM +0200, Swen Schillig via samba-technical wrote:
> Please review and push if happy.
> 
> Thanks in advance.

Not needed IMHO. consumed_path is allocated off talloc_tos()
which is being freed in the TALLOC_FREE(frame) after your
addition.

> From b1b4852feb2fd091dc045554167a5a1d9659ef70 Mon Sep 17 00:00:00 2001
> From: Swen Schillig <swen at vnet.ibm.com>
> Date: Fri, 25 May 2018 14:52:21 +0200
> Subject: [PATCH] [s3] CID 1414774: resource leak in cli_dfs_get_referral_ex
> 
> The allocated memory to gather the length of the allocated path
> must be free'd before returning.
> 
> Signed-off-by: Swen Schillig <swen at vnet.ibm.com>
> ---
>  source3/libsmb/clidfs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/source3/libsmb/clidfs.c b/source3/libsmb/clidfs.c
> index 0dfb8b33606..e162fc0af1c 100644
> --- a/source3/libsmb/clidfs.c
> +++ b/source3/libsmb/clidfs.c
> @@ -850,7 +850,7 @@ NTSTATUS cli_dfs_get_referral_ex(TALLOC_CTX *ctx,
>  	*refs = referrals;
>  
>    out:
> -
> +	TALLOC_FREE(consumed_path);
>  	TALLOC_FREE(frame);
>  	return status;
>  }
> -- 
> 2.14.4
> 




More information about the samba-technical mailing list