Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory leaks in XML config generation. #321

Open
capcah opened this issue Apr 14, 2020 · 0 comments
Open

Memory leaks in XML config generation. #321

capcah opened this issue Apr 14, 2020 · 0 comments

Comments

@capcah
Copy link

capcah commented Apr 14, 2020

Running our tests under ASAN, we found a memory leak in xml.cc, where one of the calls for getPciPath does not free the expanded path. I'll soon submit a PR closing this issue.

capcah added a commit to capcah/nccl that referenced this issue Apr 14, 2020
This patch fixes the memory leak documented in
NVIDIA#321, where one of the buffers
allocated by realpath(), inside getPciPath() is not freed.

The memory management aspect of this function also seemed odd and
unecessary, as the realpath() function is documented to only write up to
PATH_MAX bytes to the buffer passed to it, meaning we don't need dynamic
memory allocation at all. I also changed the function signature of
getPciPath to enforce the use of a fixed-size buffer.
capcah added a commit to capcah/nccl that referenced this issue Apr 14, 2020
This patch fixes the memory leak documented in
NVIDIA#321, where one of the buffers
allocated by realpath(), inside getPciPath() is not freed.

The memory management aspect of this function also seemed odd and
unecessary, as the realpath() function is documented to only write up to
PATH_MAX bytes to the buffer passed to it, meaning we don't need dynamic
memory allocation at all. I also changed the function signature of
getPciPath to enforce the use of a fixed-size buffer.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant