Skip to content

Squash some leaks#4732

Merged
ethomson merged 7 commits intomasterfrom
ethomson/leaks
Jul 23, 2018
Merged

Squash some leaks#4732
ethomson merged 7 commits intomasterfrom
ethomson/leaks

Conversation

@ethomson
Copy link
Member

When running valgrind on the online::push tests, some leaks became apparent. Two in the tests themselves, one in the product code that occurs when restarting a push on an existing remote.

ethomson added 7 commits July 20, 2018 13:57
Free the url field when resetting the stream to avoid leaking it.
Don't just free the push status structure, actually free the strings that were
strdup'd into the struct as well.
Don't just free the spec vector, also free the specs themselves.
Instead of allocating the ciphers_list, make it a static array.  This
prevents us from leaking it or having to manage its memory.
@ethomson
Copy link
Member Author

Additionally, when running valgrind on a build with mbedTLS, I saw some additional leaks.

Copy link
Contributor

@tiennou tiennou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me, thanks !

I'm slightly ashamed of being responsible for leaks. I forgot that the push suite is disabled on default runs…

@ethomson
Copy link
Member Author

I'm slightly ashamed of being responsible for leaks. I forgot that the push suite is disabled on default runs…

No problem - I'm proposing that we enable leak detection on all test runs on all builds, which is where I found it.

@ethomson ethomson merged commit 45a7897 into master Jul 23, 2018
@pks-t
Copy link
Member

pks-t commented Oct 12, 2018

This has already been backported partially, excluding the mbedtls changes as this backend doesn't yet exist in v0.27. Removing the backport label

@ethomson ethomson deleted the ethomson/leaks branch October 26, 2018 13:38
@grahamc
Copy link

grahamc commented Dec 1, 2018

I'm not sure this should have been backported, it seems this has caused some API behavior breakage. In particular, this breaks Cargo's ability to fetch repositories, specifically https://github.com/alexcrichton/git2-rs/blob/master/src/transport.rs#L223 which is fixed after reverting 49ee0ae. See also rust-lang/cargo#6365

@carlosmn
Copy link
Member

The built-in transports store a partsed version of the url themselves during initialisation and ignore the URL passed in in action.

This does look like a bug in the aforementioned commit. We run git_smart__reset_stream all the time in RPC (i.e. HTTP) mode and while it might make sense to clear the current stream, we definitely want to keep the url around.

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.

5 participants