Re: [PATCH v3 04/26] submodule--helper: fix a leak in "clone_submodule"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Ævar Arnfjörð Bjarmason  <avarab@xxxxxxxxx> writes:

> diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
> index 7d5ee6a6261..1ddce8e19c1 100644
> --- a/builtin/submodule--helper.c
> +++ b/builtin/submodule--helper.c
> @@ -1658,14 +1658,15 @@ static int clone_submodule(const struct module_clone_data *clone_data,
>  	char *sm_alternate = NULL, *error_strategy = NULL;
>  	struct child_process cp = CHILD_PROCESS_INIT;
>  	const char *clone_data_path;
> +	char *to_free = NULL;
>  
>  	if (!is_absolute_path(clone_data->path)) {
>  		struct strbuf sb = STRBUF_INIT;
>  
>  		strbuf_addf(&sb, "%s/%s", get_git_work_tree(), clone_data->path);
> -		clone_data_path = strbuf_detach(&sb, NULL);
> +		clone_data_path = to_free = strbuf_detach(&sb, NULL);
>  	} else {
> -		clone_data_path = xstrdup(clone_data_path);
> +		clone_data_path = clone_data->path;
>  	}

Heh, the bug I noticed in the previous step is silently fixed here.

This is why I do not trust a series that is artificially split into
steps and sent out without self reviewing or even compiling them.
Forces reviewers to do more work wasting their time reviewing and
finding bugs that ends up not mattering because that weren't even
something the author intended to write in the end.




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux