diff options
author | Pavel Roskin <plroskin@gmail.com> | 2016-10-16 23:40:47 -0700 |
---|---|---|
committer | Pavel Roskin <plroskin@gmail.com> | 2016-10-21 20:15:50 +0000 |
commit | 65ac8e758b6bd1458c8228613db4fec99d54d86f (patch) | |
tree | 49336ba19adf42784764d85c0e9f0d1037f1ed85 /sesman/scp.c | |
parent | 8bf28e45c4ff59f3195966a107611b211ee5aca3 (diff) | |
download | xrdp-proprietary-65ac8e758b6bd1458c8228613db4fec99d54d86f.tar.gz xrdp-proprietary-65ac8e758b6bd1458c8228613db4fec99d54d86f.zip |
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.
Diffstat (limited to 'sesman/scp.c')
-rw-r--r-- | sesman/scp.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sesman/scp.c b/sesman/scp.c index e4abe004..d81de0ab 100644 --- a/sesman/scp.c +++ b/sesman/scp.c @@ -36,7 +36,7 @@ void *DEFAULT_CC scp_process_start(void *sck) { struct SCP_CONNECTION scon; - struct SCP_SESSION *sdata; + struct SCP_SESSION *sdata = NULL; scon.in_sck = (int)(tintptr)sck; LOG_DBG("started scp thread on socket %d", scon.in_sck); @@ -89,9 +89,16 @@ scp_process_start(void *sck) break; default: log_message(LOG_LEVEL_ALWAYS, "unknown return from scp_vXs_accept()"); + break; } free_stream(scon.in_s); free_stream(scon.out_s); + + if (sdata) + { + scp_session_destroy(sdata); + } + return 0; } |