Commit bda97cb
builtin/repack: fix leaks when computing packs to repack
When writing an MIDX in git-repack(1) we first collect all the pack
names that we want to add to it in a string list. This list is marked as
`NODUP`, which indicates that it will neither duplicate nor own strings
added to it. In `write_midx_included_packs()` we then `insert()` strings
via `xstrdup()` or `strbuf_detach()`, but the resulting strings will not
be owned by anything and thus leak.
Fix this issue by marking the list as `DUP` and using a local buffer to
compute the pack names.
This leak is hit in t5319, but plugging it is not sufficient to make the
whole test suite pass.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent 8a78463 commit bda97cb
1 file changed
+27
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
732 | 732 | | |
733 | 733 | | |
734 | 734 | | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
735 | 748 | | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | | - | |
740 | 749 | | |
741 | | - | |
742 | 750 | | |
| 751 | + | |
743 | 752 | | |
744 | 753 | | |
745 | 754 | | |
| |||
754 | 763 | | |
755 | 764 | | |
756 | 765 | | |
| 766 | + | |
757 | 767 | | |
758 | 768 | | |
759 | 769 | | |
760 | 770 | | |
761 | | - | |
| 771 | + | |
762 | 772 | | |
763 | 773 | | |
764 | 774 | | |
765 | 775 | | |
766 | 776 | | |
767 | | - | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
768 | 781 | | |
769 | 782 | | |
770 | 783 | | |
| |||
784 | 797 | | |
785 | 798 | | |
786 | 799 | | |
787 | | - | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
788 | 804 | | |
| 805 | + | |
| 806 | + | |
789 | 807 | | |
790 | 808 | | |
791 | 809 | | |
| |||
1476 | 1494 | | |
1477 | 1495 | | |
1478 | 1496 | | |
1479 | | - | |
| 1497 | + | |
1480 | 1498 | | |
1481 | 1499 | | |
1482 | 1500 | | |
| |||
0 commit comments