summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorJosé Bollo <jose.bollo@iot.bzh>2016-05-11 12:14:01 +0200
committerJosé Bollo <jose.bollo@iot.bzh>2016-05-11 13:06:44 +0200
commit5b23d953d38aaf34fb6f0cc02c2e7f553c386c10 (patch)
tree5650f9bf9f370fb48bdb1d87866fd8f00f035d44 /plugins
parent4dd0c142414abd14eeaed8871cfc776139a78b28 (diff)
fix leak of messages
Change-Id: Ieb4cfcf0b791cee89fadb742d6fbf00b9739bd10 Signed-off-by: José Bollo <jose.bollo@iot.bzh>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/afm-main-plugin/utils-jbus.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/plugins/afm-main-plugin/utils-jbus.c b/plugins/afm-main-plugin/utils-jbus.c
index c4146a46..c38919d5 100644
--- a/plugins/afm-main-plugin/utils-jbus.c
+++ b/plugins/afm-main-plugin/utils-jbus.c
@@ -153,6 +153,7 @@ static int on_service_call(struct sd_bus_message *smsg, struct jbus *jbus, sd_bu
service = jbus->services;
while (service != NULL) {
if (!strcmp(service->method, member)) {
+ sd_bus_message_ref(smsg);
if (service->oncall_s)
service->oncall_s(smsg, content, service->data);
else if (service->oncall_j) {
@@ -519,7 +520,9 @@ void jbus_unref(struct jbus *jbus)
*/
int jbus_reply_error_s(struct sd_bus_message *smsg, const char *error)
{
- return mkerrno(sd_bus_reply_method_errorf(smsg, SD_BUS_ERROR_FAILED, "%s", error));
+ int rc = sd_bus_reply_method_errorf(smsg, SD_BUS_ERROR_FAILED, "%s", error);
+ sd_bus_message_unref(smsg);
+ return mkerrno(rc);
}
/*
@@ -542,7 +545,9 @@ int jbus_reply_error_j(struct sd_bus_message *smsg, struct json_object *reply)
*/
int jbus_reply_s(struct sd_bus_message *smsg, const char *reply)
{
- return mkerrno(sd_bus_reply_method_return(smsg, "s", reply));
+ int rc = sd_bus_reply_method_return(smsg, "s", reply);
+ sd_bus_message_unref(smsg);
+ return mkerrno(rc);
}
/*