Merge branch 'bc/fetch-pack-clear-alternate-shallow'

"git fetch" over protocol v2 that needs to make a second connection
to backfill tags did not clear a variable that holds shallow
repository information correctly, leading to an access of freed
piece of memory.

* bc/fetch-pack-clear-alternate-shallow:
  fetch-pack: clear alternate shallow in one more place
  fetch-pack: clear alternate shallow when complete
This commit is contained in:
Junio C Hamano 2019-02-06 22:05:30 -08:00
commit 8f0f46539a

View File

@ -1290,6 +1290,8 @@ static void receive_shallow_info(struct fetch_pack_args *args,
setup_alternate_shallow(&shallow_lock, &alternate_shallow_file,
NULL);
args->deepen = 1;
} else {
alternate_shallow_file = NULL;
}
}
@ -1514,6 +1516,7 @@ static void update_shallow(struct fetch_pack_args *args,
rollback_lock_file(&shallow_lock);
} else
commit_lock_file(&shallow_lock);
alternate_shallow_file = NULL;
return;
}
@ -1537,6 +1540,7 @@ static void update_shallow(struct fetch_pack_args *args,
&alternate_shallow_file,
&extra);
commit_lock_file(&shallow_lock);
alternate_shallow_file = NULL;
}
oid_array_clear(&extra);
return;
@ -1576,6 +1580,7 @@ static void update_shallow(struct fetch_pack_args *args,
commit_lock_file(&shallow_lock);
oid_array_clear(&extra);
oid_array_clear(&ref);
alternate_shallow_file = NULL;
return;
}