From 57df88bb0b4ce656855410a8c2969d93475c2f11 Mon Sep 17 00:00:00 2001 From: Simo Sorce Date: Tue, 24 Feb 2009 16:36:16 -0500 Subject: Proper fix for memory handling problem. sbus_message_handler is not responsible anymore for sending back data in any case. Transfer this responsibility to the handler function called. This way both synchronous and asynchronous funstions use the interface the same way and can properly free memory referenced by the reply after the send buffer has been filled in and all copies are done in sbus_conn_send_reply() --- server/infopipe/infopipe_groups.c | 55 ++++++++++++++++++++++++++++++++------- 1 file changed, 45 insertions(+), 10 deletions(-) (limited to 'server/infopipe/infopipe_groups.c') diff --git a/server/infopipe/infopipe_groups.c b/server/infopipe/infopipe_groups.c index 4b9cfc22..7ec85296 100644 --- a/server/infopipe/infopipe_groups.c +++ b/server/infopipe/infopipe_groups.c @@ -23,32 +23,67 @@ #include "util/util.h" #include "infopipe.h" -int infp_groups_create(DBusMessage *message, void *data, DBusMessage **r) +int infp_groups_create(DBusMessage *message, struct sbus_conn_ctx *sconn) { - *r = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + DBusMessage *reply; + + reply = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + + /* send reply */ + sbus_conn_send_reply(sconn, reply); + + dbus_message_unref(reply); return EOK; } -int infp_groups_delete(DBusMessage *message, void *data, DBusMessage **r) +int infp_groups_delete(DBusMessage *message, struct sbus_conn_ctx *sconn) { - *r = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + DBusMessage *reply; + + reply = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + + /* send reply */ + sbus_conn_send_reply(sconn, reply); + + dbus_message_unref(reply); return EOK; } -int infp_groups_add_members(DBusMessage *message, void *data, DBusMessage **r) +int infp_groups_add_members(DBusMessage *message, struct sbus_conn_ctx *sconn) { - *r = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + DBusMessage *reply; + + reply = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + + /* send reply */ + sbus_conn_send_reply(sconn, reply); + + dbus_message_unref(reply); return EOK; } -int infp_groups_remove_members(DBusMessage *message, void *data, DBusMessage **r) +int infp_groups_remove_members(DBusMessage *message, struct sbus_conn_ctx *sconn) { - *r = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + DBusMessage *reply; + + reply = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + + /* send reply */ + sbus_conn_send_reply(sconn, reply); + + dbus_message_unref(reply); return EOK; } -int infp_groups_set_gid(DBusMessage *message, void *data, DBusMessage **r) +int infp_groups_set_gid(DBusMessage *message, struct sbus_conn_ctx *sconn) { - *r = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + DBusMessage *reply; + + reply = dbus_message_new_error(message, DBUS_ERROR_NOT_SUPPORTED, "Not yet implemented"); + + /* send reply */ + sbus_conn_send_reply(sconn, reply); + + dbus_message_unref(reply); return EOK; } -- cgit