soc.2008.masterpassword: 762ed6c6: It doesn't appear that storage->name is ...

qulogic at pidgin.im qulogic at pidgin.im
Mon Nov 7 02:37:56 EST 2011


----------------------------------------------------------------------
Revision: 762ed6c6d0c4ad53dbe0a69c8e733327faa3cacd
Parent:   615456d9797eab2c3e6a9817fc3582b227fa9d00
Author:   qulogic at pidgin.im
Date:     11/06/11 00:48:43
Branch:   im.pidgin.soc.2008.masterpassword
URL: http://d.pidgin.im/viewmtn/revision/info/762ed6c6d0c4ad53dbe0a69c8e733327faa3cacd

Changelog: 

It doesn't appear that storage->name is really used in callbacks.

Changes against parent 615456d9797eab2c3e6a9817fc3582b227fa9d00

  patched  libpurple/plugins/keyrings/gnomekeyring.c

-------------- next part --------------
============================================================
--- libpurple/plugins/keyrings/gnomekeyring.c	f1f4fe09c6c2005e7e3f1589f0971c71b3d08ee0
+++ libpurple/plugins/keyrings/gnomekeyring.c	50bde2a87dd24d85feb1c38c6c925c6add4a741b
@@ -62,10 +62,9 @@ struct _InfoStorage
 
 struct _InfoStorage
 {
+	PurpleAccount *account;
 	gpointer cb;
 	gpointer user_data;
-	PurpleAccount *account;
-	char *name;
 };
 
 static GQuark gkp_error_domain(void)
@@ -132,11 +131,11 @@ gkp_read(PurpleAccount *account, PurpleK
 static void
 gkp_read(PurpleAccount *account, PurpleKeyringReadCallback cb, gpointer data)
 {
-	InfoStorage *storage = g_new(InfoStorage, 1);
+	InfoStorage *storage = g_new0(InfoStorage, 1);
 
+	storage->account = account;
 	storage->cb = cb;
 	storage->user_data = data;
-	storage->account = account;
 
 	gnome_keyring_find_password(GNOME_KEYRING_NETWORK_PASSWORD,
 	                            gkp_read_continue,
@@ -158,11 +157,9 @@ gkp_save_continue(GnomeKeyringResult res
 	storage = data;
 	g_return_if_fail(storage != NULL);
 
-	cb = storage->cb;
 	account = storage->account;
+	cb = storage->cb;
 
-	g_free(storage->name);
-
 	if (result != GNOME_KEYRING_RESULT_OK) {
 		switch(result) {
 			case GNOME_KEYRING_RESULT_NO_MATCH:
@@ -224,23 +221,25 @@ gkp_save(PurpleAccount *account,
          PurpleKeyringSaveCallback cb,
          gpointer data)
 {
-	InfoStorage *storage = g_new0(InfoStorage,1);
+	InfoStorage *storage = g_new0(InfoStorage, 1);
 
 	storage->account = account;
 	storage->cb = cb;
 	storage->user_data = data;
-	storage->name = g_strdup_printf("purple-%s",
-		purple_account_get_username(account));
 
 	if (password != NULL && *password != '\0') {
+		char *name;
+
 		purple_debug_info("keyring-gnome",
 			"Updating password for account %s (%s).\n",
 			purple_account_get_username(account),
 			purple_account_get_protocol_id(account));
 
+		name = g_strdup_printf("purple-%s",
+		                       purple_account_get_username(account));
 		gnome_keyring_store_password(GNOME_KEYRING_NETWORK_PASSWORD,
 		                             NULL,  /*default keyring */
-		                             storage->name,
+		                             name,
 		                             password,
 		                             gkp_save_continue,
 		                             storage,
@@ -248,6 +247,7 @@ gkp_save(PurpleAccount *account,
 		                             "user", purple_account_get_username(account),
 		                             "protocol", purple_account_get_protocol_id(account),
 		                             NULL);
+		g_free(name);
 
 	} else {	/* password == NULL, delete password. */
 		purple_debug_info("keyring-gnome",


More information about the Commits mailing list