aboutsummaryrefslogtreecommitdiffstats
path: root/src/libimcv/imc/imc_agent.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libimcv/imc/imc_agent.c')
-rw-r--r--src/libimcv/imc/imc_agent.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/libimcv/imc/imc_agent.c b/src/libimcv/imc/imc_agent.c
index 8edd59ac3..68799c817 100644
--- a/src/libimcv/imc/imc_agent.c
+++ b/src/libimcv/imc/imc_agent.c
@@ -12,6 +12,7 @@
* for more details.
*/
+#include "imcv.h"
#include "imc_agent.h"
#include <debug.h>
@@ -277,6 +278,9 @@ METHOD(imc_agent_t, destroy, void,
this->connections->destroy_function(this->connections, free);
this->connection_lock->destroy(this->connection_lock);
free(this);
+
+ /* decrease the reference count or terminate */
+ libimcv_deinit();
}
/**
@@ -288,6 +292,12 @@ imc_agent_t *imc_agent_create(const char *name,
{
private_imc_agent_t *this;
+ /* initialize or increase the reference count */
+ if (!libimcv_init())
+ {
+ return NULL;
+ }
+
INIT(this,
.public = {
.bind_functions = _bind_functions,