Skip to content

Commit e70c392

Browse files
committed
Merge branch 'kn/reflog-migration-fix-fix' into next
Fix bugs in an earlier attempt to fix "git refs migration". * kn/reflog-migration-fix-fix: refs/reftable: fix uninitialized memory access of `max_index`
2 parents bb5f4b8 + f11f0a5 commit e70c392

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

refs/reftable-backend.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,7 @@ static int prepare_transaction_update(struct write_transaction_table_arg **out,
10201020
arg->updates_nr = 0;
10211021
arg->updates_alloc = 0;
10221022
arg->updates_expected = 0;
1023+
arg->max_index = 0;
10231024
}
10241025

10251026
arg->updates_expected++;
@@ -1628,10 +1629,9 @@ static int reftable_be_transaction_finish(struct ref_store *ref_store UNUSED,
16281629
struct reftable_transaction_data *tx_data = transaction->backend_data;
16291630
int ret = 0;
16301631

1631-
if (tx_data->args)
1632-
tx_data->args->max_index = transaction->max_index;
1633-
16341632
for (size_t i = 0; i < tx_data->args_nr; i++) {
1633+
tx_data->args[i].max_index = transaction->max_index;
1634+
16351635
ret = reftable_addition_add(tx_data->args[i].addition,
16361636
write_transaction_table, &tx_data->args[i]);
16371637
if (ret < 0)

0 commit comments

Comments
 (0)