Skip to content

libssh2 shutdown#4229

Merged
ethomson merged 2 commits intolibgit2:masterfrom
pks-t:pks/ssh-memleaks
May 2, 2017
Merged

libssh2 shutdown#4229
ethomson merged 2 commits intolibgit2:masterfrom
pks-t:pks/ssh-memleaks

Conversation

@pks-t
Copy link
Copy Markdown
Member

@pks-t pks-t commented May 2, 2017

A few small cleanups regarding libssh2 and git_buf_clear/git_buf_free confusion.

The libssh2 code did not call libssh2_exit on shutdown, which I've fixed. This still leaves us with memory leaks in libssh2/libgcrypt, though, which I cannot track down with the CI only. I'll try to fire up a VM to hunt down the remaining issues, as my host system is incompatible with valgrind due to musl libc. :/

pks-t added 2 commits May 2, 2017 14:46
We unconditionally return success when initializing libssh2, regardless
of whether `libgssh2_init` signals success or an error. Fix this by
checking its return code.
After calling `libssh2_init`, we need to clean up after the library by
executing `libssh2_exit` as soon as we exit. Register a shutdown handler
to do so which simply calls `libssh2_exit`. This fixes several memory
leaks.
@pks-t
Copy link
Copy Markdown
Member Author

pks-t commented May 2, 2017

Oh, some are fixed already. Though I've seen those fixes before and have been a bit confused here -- simply forgot to fetch...

@pks-t pks-t force-pushed the pks/ssh-memleaks branch from ff07b9b to 2ce2a48 Compare May 2, 2017 12:47
@pks-t pks-t changed the title Memory leaks libssh2 shutdown May 2, 2017
@ethomson ethomson merged commit 7849e46 into libgit2:master May 2, 2017
@pks-t pks-t deleted the pks/ssh-memleaks branch June 6, 2017 07:27
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.

2 participants