Re: [PATCH 2/2] fast-import: fix segfault in store_tree()

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

 



Maxim Bublis <satori@xxxxxxxxxxxxxx> writes:

> Branch tree is NULLified by filedelete command if we are trying
> to delete root tree. Add sanity check and use load_tree() in that case.
>
> Signed-off-by: Maxim Bublis <satori@xxxxxxxxxxxxxx>
> ---
>  fast-import.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/fast-import.c b/fast-import.c
> index d73f58c..b77f12c 100644
> --- a/fast-import.c
> +++ b/fast-import.c
> @@ -1419,7 +1419,7 @@ static void mktree(struct tree_content *t, int v, struct strbuf *b)
>  
>  static void store_tree(struct tree_entry *root)
>  {
> -	struct tree_content *t = root->tree;
> +	struct tree_content *t;
>  	unsigned int i, j, del;
>  	struct last_object lo = { STRBUF_INIT, 0, 0, /* no_swap */ 1 };
>  	struct object_entry *le = NULL;
> @@ -1427,6 +1427,10 @@ static void store_tree(struct tree_entry *root)
>  	if (!is_null_sha1(root->versions[1].sha1))
>  		return;
>  
> +	if (!root->tree)
> +		load_tree(root)

Missing ';'

> +	t = root->tree;
> +
>  	for (i = 0; i < t->entry_count; i++) {
>  		if (t->entries[i]->tree)
>  			store_tree(t->entries[i]);
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[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]