sptps_stop(): clear pointers after free to avoid double free.
authorSven-Haegar Koch <haegar@sdinet.de>
Sat, 14 Apr 2012 00:29:32 +0000 (02:29 +0200)
committerGuus Sliepen <guus@tinc-vpn.org>
Sat, 14 Apr 2012 23:10:49 +0000 (01:10 +0200)
sptps_stop() may get called twice on some failed connection setups.

src/sptps.c

index bdbfb89e61d7de3a64579f67b93c0b4582b5b1d9..ff7c4168e0410b3564ceb32e74fce0da780b4f4a 100644 (file)
@@ -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;
 }