fixed two other memory leaks

This commit is contained in:
Tobias Brunner
2008-04-03 15:13:25 +00:00
parent cce97b647a
commit 471f923071
4 changed files with 6 additions and 8 deletions
+1 -5
View File
@@ -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) static peer_cfg_t* get_mediated_by(private_peer_cfg_t *this)
{ {
if (this->mediated_by) { return this->mediated_by;
this->mediated_by->get_ref(this->mediated_by);
return this->mediated_by;
}
return NULL;
} }
/** /**
+1 -1
View File
@@ -303,7 +303,7 @@ struct peer_cfg_t {
/** /**
* Get peer_cfg of the connection this one is mediated through. * 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); peer_cfg_t* (*get_mediated_by) (peer_cfg_t *this);
@@ -94,6 +94,7 @@ static void initiate(private_initiate_mediation_job_t *this)
charon->ike_sa_manager->checkin(charon->ike_sa_manager, mediated_sa); charon->ike_sa_manager->checkin(charon->ike_sa_manager, mediated_sa);
mediation_cfg = mediated_cfg->get_mediated_by(mediated_cfg); 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, if (charon->connect_manager->check_and_register(charon->connect_manager,
mediation_cfg->get_my_id(mediation_cfg), mediation_cfg->get_my_id(mediation_cfg),
+3 -2
View File
@@ -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) 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); peer_cfg->get_ref(peer_cfg);
this->peer_cfg = 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, static status_t initiate_mediated(private_ike_sa_t *this, host_t *me, host_t *other,
linked_list_t *childs, chunk_t connect_id) linked_list_t *childs, chunk_t connect_id)
{ {
this->my_host = me->clone(me); set_my_host(this, me->clone(me));
this->other_host = other->clone(other); set_other_host(this, other->clone(other));
this->connect_id = chunk_clone(connect_id); this->connect_id = chunk_clone(connect_id);
task_t *task; task_t *task;