Hi Alice (adding elfutils-devel back to CC), On Thu, 2021-07-08 at 16:34 -0400, Alice Zhang wrote: > Hi, Mark, I made modifications as you suggested. I relocated the goto > statement and now the resources will be reused.
That rearrangement is better than what I suggested with the free and (re)malloc. And thanks for adding the documentation. The commit message looks good too. > Also, I run valgrind --leak-check=full and here's the result: > ==464842== > ==464842== HEAP SUMMARY: > ==464842== in use at exit: 215,989 bytes in 2,167 blocks > ==464842== total heap usage: 3,866 allocs, 1,699 frees, 509,558 bytes > allocated > ==464842== > ==464842== LEAK SUMMARY: > ==464842== definitely lost: 0 bytes in 0 blocks > ==464842== indirectly lost: 0 bytes in 0 blocks > ==464842== possibly lost: 0 bytes in 0 blocks > ==464842== still reachable: 215,989 bytes in 2,167 blocks > ==464842== suppressed: 0 bytes in 0 blocks > ==464842== Reachable blocks (those to which a pointer was found) are not > shown. > ==464842== To see them, rerun with: --leak-check=full --show-leak-kinds=all > ==464842== > ==464842== For lists of detected and suppressed errors, rerun with: -s > ==464842== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0) Looks great. The still reachable blocks are from the libcurl global initialization and not an issue. Pushed your rearranged version to master. Thanks, Mark