[gupnp-tools] universal-cp: Fix some memory leaks
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp-tools] universal-cp: Fix some memory leaks
- Date: Sun, 24 Apr 2016 22:11:02 +0000 (UTC)
commit c052b496eac2196d64fec93f32282578a8098d1d
Author: Jens Georg <mail jensge org>
Date: Mon Apr 25 00:08:33 2016 +0200
universal-cp: Fix some memory leaks
Signed-off-by: Jens Georg <mail jensge org>
src/universal-cp/action-dialog.c | 20 ++++++++++++--------
src/universal-cp/device-treeview.c | 8 ++++----
2 files changed, 16 insertions(+), 12 deletions(-)
---
diff --git a/src/universal-cp/action-dialog.c b/src/universal-cp/action-dialog.c
index 7623e42..481b34d 100644
--- a/src/universal-cp/action-dialog.c
+++ b/src/universal-cp/action-dialog.c
@@ -331,8 +331,8 @@ run_action_dialog (GUPnPServiceActionInfo *action_info,
GUPnPServiceProxy *proxy,
GUPnPServiceIntrospection *introspection)
{
- GList *in_arguments;
- GList *out_arguments;
+ GList *in_arguments = NULL;
+ GList *out_arguments = NULL;
setup_action_dialog_labels (GUPNP_SERVICE_INFO (proxy), action_info);
@@ -361,6 +361,8 @@ run_action_dialog (GUPnPServiceActionInfo *action_info,
gtk_dialog_run (GTK_DIALOG (dialog));
gtk_widget_hide (dialog);
+ g_list_free (in_arguments);
+ g_list_free (out_arguments);
}
static void
@@ -416,12 +418,12 @@ get_action_arg_widget_info (GtkWidget *arg_widget,
introspection,
arg_info->related_state_variable);
- *value = g_slice_alloc0 (sizeof (GValue));
- g_value_init (*value, variable_info->type);
-
if (arg_info->direction == GUPNP_SERVICE_ACTION_ARG_DIRECTION_OUT)
return arg_info->name;
+ *value = g_slice_alloc0 (sizeof (GValue));
+ g_value_init (*value, variable_info->type);
+
if (variable_info->is_numeric) {
GValue double_value;
gdouble num;
@@ -623,6 +625,7 @@ display_action_out_arguments (GHashTable *out_args)
GUPnPServiceIntrospection *introspection;
GUPnPServiceActionInfo *action_info;
GList *arg_node;
+ GList *it;
action_info = get_selected_action (NULL, &introspection);
if (action_info == NULL)
@@ -630,12 +633,12 @@ display_action_out_arguments (GHashTable *out_args)
arg_node = gtk_container_get_children (GTK_CONTAINER (out_args_grid));
- for (; arg_node; arg_node = arg_node->next) {
+ for (it = arg_node; it; it = it->next) {
GtkWidget *arg_widget;
gchar *name;
- GValue *value;
+ GValue *value = NULL;
- arg_widget = GTK_WIDGET (arg_node->data);
+ arg_widget = GTK_WIDGET (it->data);
name = get_action_arg_widget_info (arg_widget,
introspection,
@@ -652,6 +655,7 @@ display_action_out_arguments (GHashTable *out_args)
}
g_object_unref (introspection);
+ g_list_free (arg_node);
}
static void
diff --git a/src/universal-cp/device-treeview.c b/src/universal-cp/device-treeview.c
index a93bf0f..7893109 100644
--- a/src/universal-cp/device-treeview.c
+++ b/src/universal-cp/device-treeview.c
@@ -390,14 +390,13 @@ on_device_icon_available (GUPnPDeviceInfo *info,
if (!gtk_tree_model_get_iter_first (model, &root_iter))
return;
- if (find_device (model, udn, &root_iter, &device_iter)) {
+ if (find_device (model, udn, &root_iter, &device_iter))
gtk_tree_store_set (GTK_TREE_STORE (model),
&device_iter,
0, icon,
-1);
- } else {
- g_object_unref (icon);
- }
+
+ g_object_unref (icon);
}
static void
@@ -675,6 +674,7 @@ append_device (GUPnPDeviceInfo *info)
GTK_TREE_VIEW (treeview),
first_row,
FALSE);
+ gtk_tree_path_free (first_row);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]