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 bdbfb89..ff7c416 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;
 }