aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ssh/src
diff options
context:
space:
mode:
authorNiclas Eklund <[email protected]>2011-04-27 16:05:01 +0200
committerNiclas Eklund <[email protected]>2011-04-27 16:05:01 +0200
commit0d2c45e628b0cd86bba0ad0ae6cdb58d6f9c024a (patch)
tree77d6b04ee4d470966a38497a9a942cc483ba60dd /lib/ssh/src
parentd33d5047ac8c0730883454878be4ea88b3b0c2cc (diff)
downloadotp-0d2c45e628b0cd86bba0ad0ae6cdb58d6f9c024a.tar.gz
otp-0d2c45e628b0cd86bba0ad0ae6cdb58d6f9c024a.tar.bz2
otp-0d2c45e628b0cd86bba0ad0ae6cdb58d6f9c024a.zip
OTP-9232:
A memory leak has been fixed. I.e. per terminated connection the size of a pid and the length of a user name string was not cleared.
Diffstat (limited to 'lib/ssh/src')
-rw-r--r--lib/ssh/src/ssh.appup.src40
-rw-r--r--lib/ssh/src/ssh_cli.erl3
-rw-r--r--lib/ssh/src/ssh_connection_handler.erl7
3 files changed, 10 insertions, 40 deletions
diff --git a/lib/ssh/src/ssh.appup.src b/lib/ssh/src/ssh.appup.src
index 9be8c3c7d5..37f24e2463 100644
--- a/lib/ssh/src/ssh.appup.src
+++ b/lib/ssh/src/ssh.appup.src
@@ -19,44 +19,12 @@
{"%VSN%",
[
- {"2.0.4", [{load_module, ssh_bits, soft_purge, soft_purge, []},
- {load_module, ssh_connection_handler, soft_purge, soft_purge, []}]},
- {"2.0.3", [{load_module, ssh_bits, soft_purge, soft_purge, []},
- {load_module, ssh_connection_handler, soft_purge, soft_purge, []},
- {load_module, ssh_file, soft_purge, soft_purge, []},
- {load_module, ssh, soft_purge, soft_purge, []},
- {load_module, ssh_rsa, soft_purge, soft_purge, []},
- {load_module, ssh_acceptor, soft_purge, soft_purge, []},
- {load_module, ssh_transport, soft_purge, soft_purge, []},
- {load_module, ssh_connection_manager, soft_purge, soft_purge, []}]},
- {"2.0.2", [{load_module, ssh_bits, soft_purge, soft_purge, []},
- {load_module, ssh_connection_handler, soft_purge, soft_purge, []},
- {load_module, ssh_file, soft_purge, soft_purge, []},
- {load_module, ssh, soft_purge, soft_purge, []},
- {load_module, ssh_rsa, soft_purge, soft_purge, []},
- {load_module, ssh_acceptor, soft_purge, soft_purge, []},
- {load_module, ssh_transport, soft_purge, soft_purge, []},
- {load_module, ssh_connection_manager, soft_purge, soft_purge, []}]}
+ {"2.0.5", [{load_module, ssh_userreg, soft_purge, soft_purge, []},
+ {load_module, ssh_connection_handler, soft_purge, soft_purge, [ssh_userreg]}]}
],
[
- {"2.0.4", [{load_module, ssh_bits, soft_purge, soft_purge, []},
- {load_module, ssh_connection_handler, soft_purge, soft_purge, []}]},
- {"2.0.3", [{load_module, ssh_bits, soft_purge, soft_purge, []},
- {load_module, ssh_connection_handler, soft_purge, soft_purge, []},
- {load_module, ssh_file, soft_purge, soft_purge, []},
- {load_module, ssh, soft_purge, soft_purge, []},
- {load_module, ssh_rsa, soft_purge, soft_purge, []},
- {load_module, ssh_acceptor, soft_purge, soft_purge, []},
- {load_module, ssh_transport, soft_purge, soft_purge, []},
- {load_module, ssh_connection_manager, soft_purge, soft_purge, []}]},
- {"2.0.2", [{load_module, ssh_bits, soft_purge, soft_purge, []},
- {load_module, ssh_connection_handler, soft_purge, soft_purge, []},
- {load_module, ssh_file, soft_purge, soft_purge, []},
- {load_module, ssh, soft_purge, soft_purge, []},
- {load_module, ssh_rsa, soft_purge, soft_purge, []},
- {load_module, ssh_acceptor, soft_purge, soft_purge, []},
- {load_module, ssh_transport, soft_purge, soft_purge, []},
- {load_module, ssh_connection_manager, soft_purge, soft_purge, []}]}
+ {"2.0.5", [{load_module, ssh_userreg, soft_purge, soft_purge, []},
+ {load_module, ssh_connection_handler, soft_purge, soft_purge, [ssh_userreg]}]}
]
}.
diff --git a/lib/ssh/src/ssh_cli.erl b/lib/ssh/src/ssh_cli.erl
index 4bfd680029..781e01b9d1 100644
--- a/lib/ssh/src/ssh_cli.erl
+++ b/lib/ssh/src/ssh_cli.erl
@@ -180,8 +180,7 @@ handle_msg(_, State) ->
%% Function: terminate(Reason, State) -> void()
%% Description: Called when the channel process is trminated
%%--------------------------------------------------------------------
-terminate(_Reason, #state{cm = ConnectionManager} = _State) ->
- (catch ssh_userreg:delete(ConnectionManager)),
+terminate(_Reason, _State) ->
ok.
%%--------------------------------------------------------------------
diff --git a/lib/ssh/src/ssh_connection_handler.erl b/lib/ssh/src/ssh_connection_handler.erl
index 2d82e6d77d..3193be2510 100644
--- a/lib/ssh/src/ssh_connection_handler.erl
+++ b/lib/ssh/src/ssh_connection_handler.erl
@@ -578,7 +578,9 @@ handle_info({CloseTag, _Socket}, _StateName,
%% Reason. The return value is ignored.
%%--------------------------------------------------------------------
terminate(normal, _, #state{transport_cb = Transport,
- socket = Socket}) ->
+ socket = Socket,
+ manager = Pid}) ->
+ (catch ssh_userreg:delete_user(Pid)),
(catch Transport:close(Socket)),
ok;
@@ -810,7 +812,7 @@ handle_disconnect(#ssh_msg_disconnect{} = Msg,
#state{ssh_params = Ssh0, manager = Pid} = State) ->
{SshPacket, Ssh} = ssh_transport:ssh_packet(Msg, Ssh0),
try
- send_msg(SshPacket, State),
+ send_msg(SshPacket, State),
ssh_connection_manager:event(Pid, Msg)
catch
exit:{noproc, _Reason} ->
@@ -822,6 +824,7 @@ handle_disconnect(#ssh_msg_disconnect{} = Msg,
[Msg, Exit]),
error_logger:info_report(Report)
end,
+ (catch ssh_userreg:delete_user(Pid)),
{stop, normal, State#state{ssh_params = Ssh}}.
counterpart_versions(NumVsn, StrVsn, #ssh{role = server} = Ssh) ->