From: Sven-Haegar Koch Date: Sat, 14 Apr 2012 00:29:32 +0000 (+0200) Subject: sptps_stop(): clear pointers after free to avoid double free. X-Git-Tag: import-tinc-1.1~383 X-Git-Url: https://git.meshlink.io/?a=commitdiff_plain;h=a5bb6d40fb517aa175510ec179091e4f9ffaf6f6;p=meshlink sptps_stop(): clear pointers after free to avoid double free. sptps_stop() may get called twice on some failed connection setups. --- diff --git a/src/sptps.c b/src/sptps.c index bdbfb89e..ff7c4168 100644 --- a/src/sptps.c +++ b/src/sptps.c @@ -576,9 +576,14 @@ bool sptps_stop(sptps_t *s) { // Clean up any resources. 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; return true; }