summaryrefslogtreecommitdiffstats
path: root/network
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2007-08-24 21:51:52 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2007-08-24 21:51:52 +0000
commit7defeed3b398d5ca874bc8e3e2fbda099b47c288 (patch)
tree493cd90af9799c9133f1cbe7d40c8056fad7e9a7 /network
parentb439d4cb2cd66a2ffee1a7aa86c677a056c61a69 (diff)
network: fixed minor memory leak
Diffstat (limited to 'network')
-rw-r--r--network/manager.c2
-rw-r--r--network/server.c39
2 files changed, 22 insertions, 19 deletions
diff --git a/network/manager.c b/network/manager.c
index 418f474b..0ac6228f 100644
--- a/network/manager.c
+++ b/network/manager.c
@@ -310,6 +310,7 @@ static int get_record(struct pending_reply *pr, uint32_t handle,
if (dbus_connection_send_with_reply(pr->conn, msg, &pending, -1) == FALSE) {
error("Can't send D-Bus message.");
+ dbus_message_unref(msg);
return -1;
}
@@ -386,6 +387,7 @@ static int get_handles(struct pending_reply *pr,
if (dbus_connection_send_with_reply(pr->conn, msg, &pending, -1) == FALSE) {
error("Can't send D-Bus message.");
+ dbus_message_unref(msg);
return -1;
}
diff --git a/network/server.c b/network/server.c
index d1ebe3ee..5694bd53 100644
--- a/network/server.c
+++ b/network/server.c
@@ -372,6 +372,7 @@ static int authorize_connection(struct network_server *ns)
if (dbus_connection_send_with_reply(ns->conn, msg, &pending, -1) == FALSE) {
error("Sending of authorization request failed");
+ dbus_message_unref(msg);
return -EACCES;
}
@@ -1130,23 +1131,6 @@ int server_register_from_file(DBusConnection *conn, const char *path,
ns = g_new0(struct network_server, 1);
- if (!dbus_connection_create_object_path(conn, path, ns,
- server_unregister)) {
- error("D-Bus failed to register %s path", path);
- server_free(ns);
- return -1;
- }
-
- if (!dbus_connection_register_interface(conn, path,
- NETWORK_SERVER_INTERFACE,
- server_methods,
- server_signals, NULL)) {
- error("D-Bus failed to register %s interface",
- NETWORK_SERVER_INTERFACE);
- dbus_connection_destroy_object_path(conn, path);
- return -1;
- }
-
bacpy(&ns->src, src);
ns->path = g_strdup(path);
ns->id = id;
@@ -1169,8 +1153,6 @@ int server_register_from_file(DBusConnection *conn, const char *path,
ns->range = textfile_get(filename, "address_range");
ns->iface = textfile_get(filename, "routing");
- info("Registered server path:%s", path);
-
str = textfile_get(filename, "enabled");
if (str) {
if (strcmp("1", str) == 0)
@@ -1178,6 +1160,25 @@ int server_register_from_file(DBusConnection *conn, const char *path,
g_free(str);
}
+ if (!dbus_connection_create_object_path(conn, path, ns,
+ server_unregister)) {
+ error("D-Bus failed to register %s path", path);
+ server_free(ns);
+ return -1;
+ }
+
+ if (!dbus_connection_register_interface(conn, path,
+ NETWORK_SERVER_INTERFACE,
+ server_methods,
+ server_signals, NULL)) {
+ error("D-Bus failed to register %s interface",
+ NETWORK_SERVER_INTERFACE);
+ dbus_connection_destroy_object_path(conn, path);
+ return -1;
+ }
+
+ info("Registered server path:%s", path);
+
return 0;
}