summaryrefslogtreecommitdiffstats
path: root/src/monitor
diff options
context:
space:
mode:
authorStephen Gallagher <sgallagh@redhat.com>2010-03-17 14:53:17 -0400
committerStephen Gallagher <sgallagh@redhat.com>2010-03-17 16:41:01 -0400
commitf1bc4e8b9daf04a5cb4b9464021bb9e816eed3ea (patch)
treee567f20493ad395a5f5b251f1f69cac6410a7789 /src/monitor
parent1d065874a1aa1db06994a16dae1a78555fabf776 (diff)
downloadsssd-f1bc4e8b9daf04a5cb4b9464021bb9e816eed3ea.tar.gz
sssd-f1bc4e8b9daf04a5cb4b9464021bb9e816eed3ea.tar.xz
sssd-f1bc4e8b9daf04a5cb4b9464021bb9e816eed3ea.zip
Fix a series of memory leaks in the SBUS
Diffstat (limited to 'src/monitor')
-rw-r--r--src/monitor/monitor.c19
-rw-r--r--src/monitor/monitor_sbus.c9
2 files changed, 19 insertions, 9 deletions
diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index 5a86e5539..0ba335467 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -687,6 +687,7 @@ static int monitor_update_resolv(struct config_file_ctx *file_ctx,
static int service_signal(struct mt_svc *svc, const char *svc_signal)
{
DBusMessage *msg;
+ int ret;
if (svc->provider && strcasecmp(svc->provider, "local") == 0) {
/* The local provider requires no signaling */
@@ -713,9 +714,12 @@ static int service_signal(struct mt_svc *svc, const char *svc_signal)
return ENOMEM;
}
- return sbus_conn_send(svc->conn, msg,
- svc->mt_ctx->service_id_timeout,
- reload_reply, svc, NULL);
+ ret = sbus_conn_send(svc->conn, msg,
+ svc->mt_ctx->service_id_timeout,
+ reload_reply, svc, NULL);
+
+ dbus_message_unref(msg);
+ return ret;
}
static int service_signal_dns_reload(struct mt_svc *svc)
@@ -1843,6 +1847,7 @@ static int monitor_service_init(struct sbus_connection *conn, void *data)
static int service_send_ping(struct mt_svc *svc)
{
DBusMessage *msg;
+ int ret;
if (!svc->conn) {
DEBUG(8, ("Service not yet initialized\n"));
@@ -1866,9 +1871,11 @@ static int service_send_ping(struct mt_svc *svc)
return ENOMEM;
}
- return sbus_conn_send(svc->conn, msg,
- svc->mt_ctx->service_id_timeout,
- ping_check, svc, NULL);
+ ret = sbus_conn_send(svc->conn, msg,
+ svc->mt_ctx->service_id_timeout,
+ ping_check, svc, NULL);
+ dbus_message_unref(msg);
+ return ret;
}
static void ping_check(DBusPendingCall *pending, void *data)
diff --git a/src/monitor/monitor_sbus.c b/src/monitor/monitor_sbus.c
index eedb60b3b..43e5b685e 100644
--- a/src/monitor/monitor_sbus.c
+++ b/src/monitor/monitor_sbus.c
@@ -111,6 +111,7 @@ int monitor_common_send_id(struct sbus_connection *conn,
{
DBusMessage *msg;
dbus_bool_t ret;
+ int retval;
/* create the message */
msg = dbus_message_new_method_call(NULL,
@@ -133,9 +134,11 @@ int monitor_common_send_id(struct sbus_connection *conn,
return EIO;
}
- return sbus_conn_send(conn, msg, 3000,
- id_callback,
- NULL, NULL);
+ retval = sbus_conn_send(conn, msg, 3000,
+ id_callback,
+ NULL, NULL);
+ dbus_message_unref(msg);
+ return retval;
}
int monitor_common_pong(DBusMessage *message,