Change order of destroy/get_ref function calls
Since DESTROY_IF might destroy the peer_cfg, a get_ref on a freed object is subject to fail.
This commit is contained in:
committed by
Tobias Brunner
parent
c230885a07
commit
dbd2169569
@@ -349,8 +349,8 @@ METHOD(ike_sa_t, get_peer_cfg, peer_cfg_t*,
|
|||||||
METHOD(ike_sa_t, set_peer_cfg, void,
|
METHOD(ike_sa_t, set_peer_cfg, void,
|
||||||
private_ike_sa_t *this, peer_cfg_t *peer_cfg)
|
private_ike_sa_t *this, peer_cfg_t *peer_cfg)
|
||||||
{
|
{
|
||||||
DESTROY_IF(this->peer_cfg);
|
|
||||||
peer_cfg->get_ref(peer_cfg);
|
peer_cfg->get_ref(peer_cfg);
|
||||||
|
DESTROY_IF(this->peer_cfg);
|
||||||
this->peer_cfg = peer_cfg;
|
this->peer_cfg = peer_cfg;
|
||||||
|
|
||||||
if (this->ike_cfg == NULL)
|
if (this->ike_cfg == NULL)
|
||||||
|
|||||||
Reference in New Issue
Block a user