[Pidgin] #9115: purple_account_option_destroy() doesn't free list key/value

Pidgin trac at pidgin.im
Tue May 5 10:04:47 EDT 2009


#9115: purple_account_option_destroy() doesn't free list key/value
------------------------------------+---------------------------------------
Reporter:  stefan.becker at nokia.com  |        Type:  defect                      
  Status:  new                      |   Component:  libpurple                   
 Version:  2.5.5                    |    Keywords:  memory leak, account options
------------------------------------+---------------------------------------
 purple_account_option_add_list_item() has this code:

 kvp = g_new0(PurpleKeyValuePair, 1);
 kvp->key = g_strdup(key);
 kvp->value = g_strdup(value);
 option->default_value.list =
 g_list_append(option->default_value.list,kvp);


 purple_account_option_destroy() only frees "kvp" and the list:

 else if (option->type == PURPLE_PREF_STRING_LIST)
 {
         if (option->default_value.list != NULL)
         {
                 g_list_foreach(option->default_value.list, (GFunc)g_free,
 NULL);
                 g_list_free(option->default_value.list);
         }
 }

 As a result libpurple leaks memory for the key & value srings.


 Of course purple_account_option_destroy() must not touch the entries
 provided by the caller to purple_account_option_list_new().

-- 
Ticket URL: <http://developer.pidgin.im/ticket/9115>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list