Skip to content

Commit 8f0f465

Browse files
committed
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
2 parents 0b5dc59 + 380ebab commit 8f0f465

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fetch-pack.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1290,6 +1290,8 @@ static void receive_shallow_info(struct fetch_pack_args *args,
12901290
setup_alternate_shallow(&shallow_lock, &alternate_shallow_file,
12911291
NULL);
12921292
args->deepen = 1;
1293+
} else {
1294+
alternate_shallow_file = NULL;
12931295
}
12941296
}
12951297

@@ -1514,6 +1516,7 @@ static void update_shallow(struct fetch_pack_args *args,
15141516
rollback_lock_file(&shallow_lock);
15151517
} else
15161518
commit_lock_file(&shallow_lock);
1519+
alternate_shallow_file = NULL;
15171520
return;
15181521
}
15191522

@@ -1537,6 +1540,7 @@ static void update_shallow(struct fetch_pack_args *args,
15371540
&alternate_shallow_file,
15381541
&extra);
15391542
commit_lock_file(&shallow_lock);
1543+
alternate_shallow_file = NULL;
15401544
}
15411545
oid_array_clear(&extra);
15421546
return;
@@ -1576,6 +1580,7 @@ static void update_shallow(struct fetch_pack_args *args,
15761580
commit_lock_file(&shallow_lock);
15771581
oid_array_clear(&extra);
15781582
oid_array_clear(&ref);
1583+
alternate_shallow_file = NULL;
15791584
return;
15801585
}
15811586

0 commit comments

Comments
 (0)