diff options
author | Pavel Roskin <plroskin@gmail.com> | 2017-01-25 23:32:57 +0000 |
---|---|---|
committer | jsorg71 <jay.sorg@gmail.com> | 2017-02-02 21:24:50 -0800 |
commit | 0017081d78dafbea4602229898ed41e2d6ab6283 (patch) | |
tree | 3c4cdb43939f72ddb8e7451d7aa6e9044f423348 /sesman | |
parent | 021b79ba55009f8ef826d5a27b7aec1532f6f9cd (diff) | |
download | xrdp-proprietary-0017081d78dafbea4602229898ed41e2d6ab6283.tar.gz xrdp-proprietary-0017081d78dafbea4602229898ed41e2d6ab6283.zip |
xrdp-sesadmin: fix crash on network or authentication error
If scp_v1c_mng_get_session_list() returns an error, report it to the
user and exit. Session list is not initialized in that case and should
not be freed.
g_free() already checks its argument for being to NULL, remove an extra
check.
Diffstat (limited to 'sesman')
-rw-r--r-- | sesman/tools/sesadmin.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/sesman/tools/sesadmin.c b/sesman/tools/sesadmin.c index 7d66ad2e..b76b407e 100644 --- a/sesman/tools/sesadmin.c +++ b/sesman/tools/sesadmin.c @@ -196,7 +196,13 @@ void cmndList(struct SCP_CONNECTION *c) e = scp_v1c_mng_get_session_list(c, &scnt, &dsl); - if ((SCP_CLIENT_STATE_LIST_OK == e) && (scnt > 0)) + if (e != SCP_CLIENT_STATE_LIST_OK) + { + printf("Error getting session list.\n"); + return; + } + + if (scnt > 0) { for (idx = 0; idx < scnt; idx++) { @@ -211,10 +217,7 @@ void cmndList(struct SCP_CONNECTION *c) printf("No sessions.\n"); } - if (0 != dsl) - { - g_free(dsl); - } + g_free(dsl); } void cmndKill(struct SCP_CONNECTION *c, struct SCP_SESSION *s) |