Created attachment 3235 [details] client_cleanup.diff After completing the session, the client leaks the ssh structure and the host_arg. Also, on cleanup, packet.c leaks the kex-structure (which is held inside the ssh struct). I've also moved host_arg from global to local variable, because it is only passed to one function. Patch is attached.
Created attachment 3237 [details] fixex leaks and a problem with previous patch (sorry for the mess).