check if optional terminate() function exists
[strongswan.git] / src / libcharon / plugins / tnc_imc / tnc_imc_plugin.c
index 8348c5d..21cca66 100644 (file)
@@ -25,7 +25,8 @@ METHOD(plugin_t, destroy, void,
 
        while (charon->imcs->remove_last(charon->imcs, (void**)&imc) == SUCCESS)
        {
-               if (imc->terminate(imc->get_id(imc)) != TNC_RESULT_SUCCESS)
+               if (imc->terminate &&
+                       imc->terminate(imc->get_id(imc)) != TNC_RESULT_SUCCESS)
                {
                        DBG1(DBG_TNC, "IMC '%s' not terminated successfully",
                                                   imc->get_name(imc));
@@ -45,7 +46,6 @@ plugin_t *tnc_imc_plugin_create()
        char *tnc_config, *pref_lang, *name, *filename;
        tnc_imc_plugin_t *this;
        imc_t *imc;
-       
 
        INIT(this,
                .plugin = {
@@ -64,15 +64,15 @@ plugin_t *tnc_imc_plugin_create()
        if (imc)
        {
                /* Initialize the module */
-               if (imc->initialize(next_id, TNC_IFIMC_VERSION_1, TNC_IFIMC_VERSION_1, 
+               if (imc->initialize(next_id, TNC_IFIMC_VERSION_1, TNC_IFIMC_VERSION_1,
                                                        &version) != TNC_RESULT_SUCCESS)
-               {
+               {
                        DBG1(DBG_TNC, "could not initialize IMC '%s'\n",
                                                   imc->get_name(imc));
                        imc->destroy(imc);
                }
                else
-       {
+               {
                        charon->imcs->insert_last(charon->imcs, imc);
                        next_id++;
                }