diff options
author | Tobias Brunner <tobias@strongswan.org> | 2008-04-03 15:13:25 +0000 |
---|---|---|
committer | Tobias Brunner <tobias@strongswan.org> | 2008-04-03 15:13:25 +0000 |
commit | 471f923071100078c73b42587f249aaac103f8e1 (patch) | |
tree | de0e4b95e6712e3a0c5d57f7cdb572128e111484 | |
parent | cce97b647adbc69667401481c7cebc51c42efeb1 (diff) | |
download | strongswan-471f923071100078c73b42587f249aaac103f8e1.tar.bz2 strongswan-471f923071100078c73b42587f249aaac103f8e1.tar.xz |
fixed two other memory leaks
-rw-r--r-- | src/charon/config/peer_cfg.c | 6 | ||||
-rw-r--r-- | src/charon/config/peer_cfg.h | 2 | ||||
-rw-r--r-- | src/charon/processing/jobs/initiate_mediation_job.c | 1 | ||||
-rw-r--r-- | src/charon/sa/ike_sa.c | 5 |
4 files changed, 6 insertions, 8 deletions
diff --git a/src/charon/config/peer_cfg.c b/src/charon/config/peer_cfg.c index 9e11f883e..d85935c60 100644 --- a/src/charon/config/peer_cfg.c +++ b/src/charon/config/peer_cfg.c @@ -449,11 +449,7 @@ static bool is_mediation(private_peer_cfg_t *this) */ static peer_cfg_t* get_mediated_by(private_peer_cfg_t *this) { - if (this->mediated_by) { - this->mediated_by->get_ref(this->mediated_by); - return this->mediated_by; - } - return NULL; + return this->mediated_by; } /** diff --git a/src/charon/config/peer_cfg.h b/src/charon/config/peer_cfg.h index e8c0e6063..43bcb8ef6 100644 --- a/src/charon/config/peer_cfg.h +++ b/src/charon/config/peer_cfg.h @@ -303,7 +303,7 @@ struct peer_cfg_t { /** * Get peer_cfg of the connection this one is mediated through. * - * @return reference to peer_cfg of the mediation connection + * @return the peer_cfg of the mediation connection */ peer_cfg_t* (*get_mediated_by) (peer_cfg_t *this); diff --git a/src/charon/processing/jobs/initiate_mediation_job.c b/src/charon/processing/jobs/initiate_mediation_job.c index 379942069..483420b99 100644 --- a/src/charon/processing/jobs/initiate_mediation_job.c +++ b/src/charon/processing/jobs/initiate_mediation_job.c @@ -94,6 +94,7 @@ static void initiate(private_initiate_mediation_job_t *this) charon->ike_sa_manager->checkin(charon->ike_sa_manager, mediated_sa); mediation_cfg = mediated_cfg->get_mediated_by(mediated_cfg); + mediation_cfg->get_ref(mediation_cfg); if (charon->connect_manager->check_and_register(charon->connect_manager, mediation_cfg->get_my_id(mediation_cfg), diff --git a/src/charon/sa/ike_sa.c b/src/charon/sa/ike_sa.c index 58a344529..14200793f 100644 --- a/src/charon/sa/ike_sa.c +++ b/src/charon/sa/ike_sa.c @@ -396,6 +396,7 @@ static peer_cfg_t* get_peer_cfg(private_ike_sa_t *this) */ static void set_peer_cfg(private_ike_sa_t *this, peer_cfg_t *peer_cfg) { + DESTROY_IF(this->peer_cfg); peer_cfg->get_ref(peer_cfg); this->peer_cfg = peer_cfg; @@ -1007,8 +1008,8 @@ static status_t initiate_mediation(private_ike_sa_t *this, peer_cfg_t *mediated_ static status_t initiate_mediated(private_ike_sa_t *this, host_t *me, host_t *other, linked_list_t *childs, chunk_t connect_id) { - this->my_host = me->clone(me); - this->other_host = other->clone(other); + set_my_host(this, me->clone(me)); + set_other_host(this, other->clone(other)); this->connect_id = chunk_clone(connect_id); task_t *task; |