[gnome-packagekit/gnome-2-28] trivial: don't leak path or client in the error path
- From: Richard Hughes <rhughes src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [gnome-packagekit/gnome-2-28] trivial: don't leak path or client in the error path
- Date: Tue, 5 Jan 2010 11:08:09 +0000 (UTC)
commit 60fbb5aa0e9b84f201439080adb0205a88a1eeeb
Author: Richard Hughes <richard hughsie com>
Date: Tue Jan 5 08:48:38 2010 +0000
trivial: don't leak path or client in the error path
src/gpk-repo.c | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/gpk-repo.c b/src/gpk-repo.c
index 2cce71c..b35fe7e 100644
--- a/src/gpk-repo.c
+++ b/src/gpk-repo.c
@@ -171,15 +171,15 @@ gpk_misc_enabled_toggled (GtkCellRendererToggle *cell, gchar *path_str, gpointer
GtkTreeIter iter;
GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
gboolean enabled;
- gchar *repo_id;
+ gchar *repo_id = NULL;
gboolean ret;
GError *error = NULL;
- PkClient *client;
+ PkClient *client = NULL;
/* do we have the capability? */
if (pk_bitfield_contain (roles, PK_ROLE_ENUM_REPO_ENABLE) == FALSE) {
egg_debug ("can't change state");
- return;
+ goto out;
}
/* get toggled iter */
@@ -204,7 +204,6 @@ gpk_misc_enabled_toggled (GtkCellRendererToggle *cell, gchar *path_str, gpointer
g_error_free (error);
goto out;
}
- g_object_unref (client);
/* set new value */
gtk_list_store_set (GTK_LIST_STORE (model), &iter,
@@ -213,6 +212,8 @@ gpk_misc_enabled_toggled (GtkCellRendererToggle *cell, gchar *path_str, gpointer
out:
/* clean up */
+ if (client != NULL)
+ g_object_unref (client);
g_free (repo_id);
gtk_tree_path_free (path);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]