diff --git a/ssh.c b/ssh.c index 1d887230..61786b10 100644 --- a/ssh.c +++ b/ssh.c @@ -4356,9 +4356,11 @@ static int do_ssh2_transport(Ssh ssh, unsigned char *in, int inlen, int ispkt) logeventf(ssh, "Initialised %s decompression", ssh->sccomp->text_name); freebn(s->f); - freebn(s->g); freebn(s->K); - freebn(s->p); + if (ssh->kex == &ssh_diffiehellman_gex) { + freebn(s->g); + freebn(s->p); + } /* * If this is the first key exchange phase, we must pass the