[strongSwan-dev] Correct place to destroy peer_cfg in plugin?

Martin Willi martin at strongswan.org
Thu Apr 8 13:34:53 CEST 2010

Hi Ian,

> Currently when the IKE SA is destroyed (ike_sa->destroy) I see that the
> in the call to DESTROY_IF(this->peer_cfg) that the refcount is 2 (as a
> result of the call to ike_sa->set_peer_cfg) so does not get deleted at
> this time and is in fact never released. 

ike_sa->set_peer_cfg() takes a reference, so you can destroy() it to
release the reference as soon as you have passed it to set_peer_cfg().

Alternatively, you can use the control wrapper functionality provided by
controller_t. The initiate() method automatically consumes a reference
to the passed config.


More information about the Dev mailing list