Commit f4dbdfc
commit-graph: clean up leaked memory during write
The write_commit_graph() method in commit-graph.c leaks some lits
and strings during execution. In addition, a list of strings is
leaked in write_commit_graph_reachable(). Clean these up so our
memory checking is cleaner.
Further, if we use a list of pack-files to find the commits, we
can leak the packed_git structs after scanning them for commits.
Running the following commands demonstrates the leak before and
the fix after:
* valgrind --leak-check=full ./git commit-graph write --reachable
* valgrind --leak-check=full ./git commit-graph write --stdin-packs
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent 6b89a34 commit f4dbdfc
1 file changed
+9
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
693 | 693 | | |
694 | 694 | | |
695 | 695 | | |
696 | | - | |
| 696 | + | |
697 | 697 | | |
698 | | - | |
699 | 698 | | |
700 | 699 | | |
| 700 | + | |
| 701 | + | |
701 | 702 | | |
702 | 703 | | |
703 | 704 | | |
| |||
764 | 765 | | |
765 | 766 | | |
766 | 767 | | |
| 768 | + | |
767 | 769 | | |
768 | 770 | | |
769 | 771 | | |
| |||
846 | 848 | | |
847 | 849 | | |
848 | 850 | | |
849 | | - | |
| 851 | + | |
| 852 | + | |
850 | 853 | | |
851 | 854 | | |
| 855 | + | |
852 | 856 | | |
853 | 857 | | |
854 | 858 | | |
| |||
893 | 897 | | |
894 | 898 | | |
895 | 899 | | |
| 900 | + | |
| 901 | + | |
896 | 902 | | |
897 | | - | |
898 | | - | |
899 | 903 | | |
900 | 904 | | |
901 | 905 | | |
| |||
0 commit comments