summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVinicius Costa Gomes <vinicius.gomes@openbossa.org>2008-09-01 17:26:10 -0300
committerVinicius Costa Gomes <vinicius.gomes@openbossa.org>2008-09-01 19:42:37 -0300
commite3c0f1dabde976043b02858bd135b2081a9cbe90 (patch)
treecf401ac14b26cc63d40aeb1f9277c1142b231a25
parent0c05dd3dc5a18d64734a9f091d5285612e41107b (diff)
Removes the agent when the adapter is freed, if it wasn't already done
-rw-r--r--src/adapter.c3
-rw-r--r--src/agent.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/src/adapter.c b/src/adapter.c
index a22112c8..98dc8ce2 100644
--- a/src/adapter.c
+++ b/src/adapter.c
@@ -2747,6 +2747,9 @@ static void adapter_free(gpointer user_data)
{
struct adapter *adapter = user_data;
+ agent_destroy(adapter->agent, FALSE);
+ adapter->agent = NULL;
+
g_free(adapter->path);
g_free(adapter);
diff --git a/src/agent.c b/src/agent.c
index 9870cb10..c35b2500 100644
--- a/src/agent.c
+++ b/src/agent.c
@@ -217,6 +217,9 @@ struct agent *agent_create(struct adapter *adapter, const char *name,
int agent_destroy(struct agent *agent, gboolean exited)
{
+ if (!agent)
+ return 0;
+
agent->exited = exited;
agent_free(agent);
return 0;