Reproduction steps
I originally discovered these memory leaks by reading the code. To confirm my suspicions I ran valgrind, which discovered a couple more. I attach the valgrind output, which clearly shows the causes of the leaks.
valgrind1.txt
Expected behavior
Memory leaks are bad, even in example programs (or maybe especially in example programs). There should be no memory leaks in any of the example programs.
Actual behavior
There are ten memory leaks in examples/general.
Version of libgit2 (release number or SHA1)
v0.25.0
Operating system(s) tested
Lubuntu 16.10
Additional Information
Valgrind also detected the use of an uninitialized variable ("j") in config_files(). I have submitted a Pull Request to fix this problem.
Reactions are currently unavailable
Reproduction steps
I originally discovered these memory leaks by reading the code. To confirm my suspicions I ran valgrind, which discovered a couple more. I attach the valgrind output, which clearly shows the causes of the leaks.
valgrind1.txt
Expected behavior
Memory leaks are bad, even in example programs (or maybe especially in example programs). There should be no memory leaks in any of the example programs.
Actual behavior
There are ten memory leaks in examples/general.
Version of libgit2 (release number or SHA1)
v0.25.0
Operating system(s) tested
Lubuntu 16.10
Additional Information
Valgrind also detected the use of an uninitialized variable ("j") in config_files(). I have submitted a Pull Request to fix this problem.