From 65ac8e758b6bd1458c8228613db4fec99d54d86f Mon Sep 17 00:00:00 2001 From: Pavel Roskin Date: Sun, 16 Oct 2016 23:40:47 -0700 Subject: Fix memory leak: free session data Call scp_session_destroy() in the functions that call scp_session_create() and nowhere else. As found by Valgrind, the session data is not freed if the session is created successfully. --- sesman/scp_v1.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'sesman/scp_v1.c') diff --git a/sesman/scp_v1.c b/sesman/scp_v1.c index 1501606d..df138147 100644 --- a/sesman/scp_v1.c +++ b/sesman/scp_v1.c @@ -77,7 +77,6 @@ scp_v1_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s) default: /* we check the other errors */ parseCommonStates(e, "scp_v1s_list_sessions()"); - scp_session_destroy(s); return; //break; } @@ -88,7 +87,6 @@ scp_v1_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s) scp_v1s_deny_connection(c, "Login failed"); log_message( LOG_LEVEL_INFO, "Login failed for user %s. Connection terminated", s->username); - scp_session_destroy(s); return; } @@ -98,7 +96,6 @@ scp_v1_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s) scp_v1s_deny_connection(c, "Access to Terminal Server not allowed."); log_message(LOG_LEVEL_INFO, "User %s not allowed on TS. Connection terminated", s->username); - scp_session_destroy(s); return; } @@ -204,7 +201,6 @@ scp_v1_process(struct SCP_CONNECTION *c, struct SCP_SESSION *s) } /* cleanup */ - scp_session_destroy(s); auth_end(data); g_free(slist); } -- cgit v1.2.3