Fix memory leaks found by valgrind.

This commit is contained in:
Guus Sliepen 2012-10-09 16:27:28 +02:00
parent 72642b40b3
commit d1ec010660
6 changed files with 20 additions and 12 deletions

View file

@ -627,18 +627,17 @@ bool sptps_start(sptps_t *s, void *handle, bool initiator, bool datagram, ecdsa_
// Stop a SPTPS session.
bool sptps_stop(sptps_t *s) {
// Clean up any resources.
cipher_close(&s->incipher);
cipher_close(&s->outcipher);
digest_close(&s->indigest);
digest_close(&s->outdigest);
ecdh_free(&s->ecdh);
free(s->inbuf);
s->inbuf = NULL;
free(s->mykex);
s->mykex = NULL;
free(s->hiskex);
s->hiskex = NULL;
free(s->key);
s->key = NULL;
free(s->label);
s->label = NULL;
free(s->late);
s->late = NULL;
memset(s, 0, sizeof *s);
return true;
}