abort if one of the IMCs or IMVs fail to initialize
This commit is contained in:
@@ -70,6 +70,7 @@ METHOD(imv_manager_t, add, bool,
|
||||
this->imvs->remove_last(this->imvs, (void**)&imv);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@@ -89,6 +90,7 @@ METHOD(imv_manager_t, remove_, imv_t*,
|
||||
}
|
||||
}
|
||||
enumerator->destroy(enumerator);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
METHOD(imv_manager_t, notify_connection_change, void,
|
||||
@@ -192,8 +194,5 @@ imv_manager_t* tnc_imv_manager_create(void)
|
||||
.next_imv_id = 1,
|
||||
);
|
||||
|
||||
|
||||
return &this->public;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -47,15 +47,27 @@ plugin_t *tnc_imv_plugin_create()
|
||||
/* Create IMV manager */
|
||||
charon->imvs = tnc_imv_manager_create();
|
||||
|
||||
/* Create and register IMVs */
|
||||
name = "Dummy";
|
||||
filename = "/usr/local/lib/libdummyimv.so";
|
||||
imv = tnc_imv_create(name, filename);
|
||||
if (imv)
|
||||
/**
|
||||
* Create, register and initialize IMVs
|
||||
* Abort if one of the IMVs fails to initialize successfully
|
||||
*/
|
||||
{
|
||||
name = "Dummy";
|
||||
filename = "/usr/local/lib/libdummyimv.so";
|
||||
imv = tnc_imv_create(name, filename);
|
||||
|
||||
if (!imv)
|
||||
{
|
||||
charon->imvs->destroy(charon->imvs);
|
||||
free(this);
|
||||
return NULL;
|
||||
}
|
||||
if (!charon->imvs->add(charon->imvs, imv))
|
||||
{
|
||||
imv->destroy(imv);
|
||||
charon->imvs->destroy(charon->imvs);
|
||||
free(this);
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
return &this->plugin;
|
||||
|
||||
Reference in New Issue
Block a user