Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix a leak in the local transport code. #1675

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

Merged

Conversation

arthurschreiber
Copy link
Member

This fixes the leak described in #1673.

@vmg
Copy link
Member

vmg commented Jun 24, 2013

I'll defer to @carlosmn and @ethomson.

@arrbee
Copy link
Member

arrbee commented Jun 24, 2013

This PR seems fine to me. The refs are loaded in local_connect, so it makes sense that they should be unloaded in local_close.

I think eventually we should go further with fixing this because right now it appears to me that calling local_connect doesn't make any effort to check if the transport is already connected and will happily reallocate all the structures and simply overwrite the existing allocated objects. It would not be hard to make it an error or a no-op if you try to connect a transport that is already connected.

However, that goal need not be part of this PR. This fixes the memory leak from closing and then reconnecting the transport.

arrbee added a commit that referenced this pull request Jun 24, 2013
…port

Fix a leak in the local transport code.
@arrbee arrbee merged commit 5b4a708 into libgit2:development Jun 24, 2013
@arthurschreiber
Copy link
Member Author

Thanks @arrbee!

@arthurschreiber arthurschreiber deleted the fix-leak-in-local-transport branch June 24, 2013 21:47
@carlosmn
Copy link
Member

The remote reference list needs to survive a disconnect. Otherwise you won't be able to call git_remote_ls after you've disconnected from the remote.

@arrbee
Copy link
Member

arrbee commented Jun 25, 2013

Hmm, okay. Then I think we need to put some checks in place (as I mentioned above) to use the internal state of the transport to avoid leaking memory. We can write an alternate fix for this tomorrow.

phatblat pushed a commit to phatblat/libgit2 that referenced this pull request Sep 13, 2014
…l-transport

Fix a leak in the local transport code.
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

Successfully merging this pull request may close these issues.

4 participants