summaryrefslogtreecommitdiffhomepage
path: root/svr-authpubkeyoptions.c
diff options
context:
space:
mode:
authorMatt Johnston <matt@ucc.asn.au>2017-05-10 00:20:33 +0800
committerMatt Johnston <matt@ucc.asn.au>2017-05-10 00:20:33 +0800
commitbda3bc4c8d910b293fec51cf8e66a5ac4ae709aa (patch)
treeb2598d3a6c106ee5ecda10c306d2865dee7468f0 /svr-authpubkeyoptions.c
parent93f3c31807cc15c19640d7242883b24b374a7fde (diff)
free forced_command
Diffstat (limited to 'svr-authpubkeyoptions.c')
-rw-r--r--svr-authpubkeyoptions.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/svr-authpubkeyoptions.c b/svr-authpubkeyoptions.c
index 9bdf99d..55b78ba 100644
--- a/svr-authpubkeyoptions.c
+++ b/svr-authpubkeyoptions.c
@@ -95,6 +95,7 @@ void svr_pubkey_set_forced_command(struct ChanSess *chansess) {
if (chansess->cmd) {
/* original_command takes ownership */
chansess->original_command = chansess->cmd;
+ chansess->cmd = NULL;
} else {
chansess->original_command = m_strdup("");
}
@@ -108,6 +109,9 @@ void svr_pubkey_set_forced_command(struct ChanSess *chansess) {
/* Free potential public key options */
void svr_pubkey_options_cleanup() {
if (ses.authstate.pubkey_options) {
+ if (ses.authstate.pubkey_options->forced_command) {
+ m_free(ses.authstate.pubkey_options->forced_command);
+ }
m_free(ses.authstate.pubkey_options);
ses.authstate.pubkey_options = NULL;
}
@@ -200,8 +204,7 @@ next_option:
bad_option:
ret = DROPBEAR_FAILURE;
- m_free(ses.authstate.pubkey_options);
- ses.authstate.pubkey_options = NULL;
+ svr_pubkey_options_cleanup();
dropbear_log(LOG_WARNING, "Bad public key options at %s:%d", filename, line_num);
end: