[libgfbgraph] node: Plug some leaks
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgfbgraph] node: Plug some leaks
- Date: Tue, 4 Oct 2016 08:38:59 +0000 (UTC)
commit bc03c1f8fa59d80b9a12c0a57c26e7a2f852651e
Author: Krzesimir Nowak <krzesimir kinvolk io>
Date: Tue Sep 27 15:55:00 2016 +0200
node: Plug some leaks
gfbgraph/gfbgraph-node.c | 19 ++++++++++---------
1 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/gfbgraph/gfbgraph-node.c b/gfbgraph/gfbgraph-node.c
index 84d0040..9ce84bf 100644
--- a/gfbgraph/gfbgraph-node.c
+++ b/gfbgraph/gfbgraph-node.c
@@ -306,6 +306,7 @@ gfbgraph_node_new_from_id (GFBGraphAuthorizer *authorizer, const gchar *id, GTyp
g_object_unref (jparser);
}
+ g_object_unref (rest_call);
return node;
}
@@ -443,19 +444,18 @@ gfbgraph_node_get_connection_nodes (GFBGraphNode *node, GType node_type, GFBGrap
gfbgraph_connectable_get_connection_path (GFBGRAPH_CONNECTABLE
(connected_node),
G_OBJECT_TYPE (node)));
rest_proxy_call_set_function (rest_call, function_path);
+ g_free (function_path);
if (rest_proxy_call_sync (rest_call, error)) {
const gchar *payload;
payload = rest_proxy_call_get_payload (rest_call);
nodes_list = gfbgraph_connectable_parse_connected_data (GFBGRAPH_CONNECTABLE
(connected_node), payload, error);
- } else {
- return NULL;
}
/* We don't need this node again */
- g_clear_object (&connected_node);
- g_free (function_path);
+ g_object_unref (connected_node);
+ g_object_unref (rest_call);
return nodes_list;
@@ -549,6 +549,7 @@ gfbgraph_node_append_connection (GFBGraphNode *node, GFBGraphNode *connect_node,
RestProxyCall *rest_call;
GHashTable *params;
gchar *function_path;
+ gboolean success;
g_return_val_if_fail (GFBGRAPH_IS_NODE (node), FALSE);
g_return_val_if_fail (GFBGRAPH_IS_NODE (connect_node), FALSE);
@@ -570,6 +571,7 @@ gfbgraph_node_append_connection (GFBGraphNode *node, GFBGraphNode *connect_node,
priv = GFBGRAPH_NODE_GET_PRIVATE (node);
+ success = FALSE;
rest_call = gfbgraph_new_rest_call (authorizer);
rest_proxy_call_set_method (rest_call, "POST");
function_path = g_strdup_printf ("%s/%s",
@@ -577,6 +579,7 @@ gfbgraph_node_append_connection (GFBGraphNode *node, GFBGraphNode *connect_node,
gfbgraph_connectable_get_connection_path (GFBGRAPH_CONNECTABLE
(connect_node),
G_OBJECT_TYPE (node)));
rest_proxy_call_set_function (rest_call, function_path);
+ g_free (function_path);
params = gfbgraph_connectable_get_connection_post_params (GFBGRAPH_CONNECTABLE (connect_node),
G_OBJECT_TYPE (node));
if (g_hash_table_size (params) > 0) {
@@ -610,11 +613,9 @@ gfbgraph_node_append_connection (GFBGraphNode *node, GFBGraphNode *connect_node,
g_object_unref (jreader);
g_object_unref (jparser);
- } else {
- return FALSE;
+ success = TRUE;
}
+ g_object_unref (rest_call);
- g_free (function_path);
-
- return TRUE;
+ return success;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]