File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -1451,6 +1451,15 @@ static int write_midx_internal(const char *object_dir,
1451
1451
1452
1452
commits = find_commits_for_midx_bitmap (& commits_nr , refs_snapshot , & ctx );
1453
1453
1454
+ /*
1455
+ * The previous steps translated the information from
1456
+ * 'entries' into information suitable for constructing
1457
+ * bitmaps. We no longer need that array, so clear it to
1458
+ * reduce memory pressure.
1459
+ */
1460
+ FREE_AND_NULL (ctx .entries );
1461
+ ctx .entries_nr = 0 ;
1462
+
1454
1463
if (write_midx_bitmap (midx_name .buf , midx_hash , & pdata ,
1455
1464
commits , commits_nr , ctx .pack_order ,
1456
1465
refs_snapshot , flags ) < 0 ) {
@@ -1459,6 +1468,10 @@ static int write_midx_internal(const char *object_dir,
1459
1468
goto cleanup ;
1460
1469
}
1461
1470
}
1471
+ /*
1472
+ * NOTE: Do not use ctx.entries beyond this point, since it might
1473
+ * have been freed in the previous if block.
1474
+ */
1462
1475
1463
1476
if (ctx .m )
1464
1477
close_object_store (the_repository -> objects );
You can’t perform that action at this time.
0 commit comments