Code Review
/
src
/
app-framework-binder.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Merge branch 'master'
[src/app-framework-binder.git]
/
plugins
/
afm-main-plugin
/
utils-jbus.c
diff --git
a/plugins/afm-main-plugin/utils-jbus.c
b/plugins/afm-main-plugin/utils-jbus.c
index
d3f2302
..
c38919d
100644
(file)
--- a/
plugins/afm-main-plugin/utils-jbus.c
+++ b/
plugins/afm-main-plugin/utils-jbus.c
@@
-24,8
+24,9
@@
#include <poll.h>
#include <assert.h>
#include <poll.h>
#include <assert.h>
-#include <json.h>
+#include <json
-c/json
.h>
#include <systemd/sd-bus.h>
#include <systemd/sd-bus.h>
+#include <systemd/sd-bus-protocol.h>
#include "utils-jbus.h"
#include "utils-jbus.h"
@@
-152,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)) {
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) {
if (service->oncall_s)
service->oncall_s(smsg, content, service->data);
else if (service->oncall_j) {
@@
-518,7
+520,9
@@
void jbus_unref(struct jbus *jbus)
*/
int jbus_reply_error_s(struct sd_bus_message *smsg, const char *error)
{
*/
int jbus_reply_error_s(struct sd_bus_message *smsg, const char *error)
{
- return mkerrno(sd_bus_reply_method_errorf(smsg, "error", "%s", error));
+ int rc = sd_bus_reply_method_errorf(smsg, SD_BUS_ERROR_FAILED, "%s", error);
+ sd_bus_message_unref(smsg);
+ return mkerrno(rc);
}
/*
}
/*
@@
-541,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)
{
*/
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);
}
/*
}
/*