From: <dat...@us...> - 2006-11-22 00:43:49
|
Revision: 17805 http://svn.sourceforge.net/gaim/?rev=17805&view=rev Author: datallah Date: 2006-11-21 16:43:42 -0800 (Tue, 21 Nov 2006) Log Message: ----------- Don't allow invalid plugin callbacks to registered (and eventually crash). Fix an unlikely leak. Modified Paths: -------------- trunk/libgaim/prefs.c Modified: trunk/libgaim/prefs.c =================================================================== --- trunk/libgaim/prefs.c 2006-11-21 21:05:44 UTC (rev 17804) +++ trunk/libgaim/prefs.c 2006-11-22 00:43:42 UTC (rev 17805) @@ -617,6 +617,7 @@ remove_pref(struct gaim_pref *pref) { char *name; + GSList *l; if(!pref || pref == &prefs) return; @@ -643,7 +644,11 @@ free_pref_value(pref); - g_slist_free(pref->callbacks); + while((l = pref->callbacks) != NULL) { + pref->callbacks = pref->callbacks->next; + g_free(l->data); + g_slist_free_1(l); + } g_free(pref->name); g_free(pref); } @@ -1008,6 +1013,9 @@ struct pref_cb *cb; static guint cb_id = 0; + g_return_val_if_fail(name != NULL, 0); + g_return_val_if_fail(func != NULL, 0); + pref = find_pref(name); if (pref == NULL) return 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |