peer-cfg: Fix memory leak when replacing child configs
authorTobias Brunner <tobias@strongswan.org>
Fri, 11 Nov 2016 14:30:54 +0000 (15:30 +0100)
committerTobias Brunner <tobias@strongswan.org>
Fri, 11 Nov 2016 14:34:33 +0000 (15:34 +0100)
Fixes: 622c2b2c3386 ("peer-cfg: Add method to atomically replace child
configs")

src/libcharon/config/peer_cfg.c

index 6463c7a..5665b66 100644 (file)
@@ -235,6 +235,7 @@ METHOD(enumerator_t, child_cfgs_replace_enumerate, bool,
                {
                        break;
                }
+               this->wrapped->destroy(this->wrapped);
                this->wrapped = this->added->create_enumerator(this->added);
                this->add = TRUE;
        }