/* Use this function to free a key list.  */
void free_key_list(GList *list)
/* Use this function to free a key list.  */
void free_key_list(GList *list)
{
    guint i,n;
    decryption_key_t *curr_key;
    if (list == NULL)
        return;
    n = g_list_length(list);
    for(i = 0; i < n; i++)
    {
        curr_key = (decryption_key_t*)g_list_nth_data(list,i);
        if (curr_key->key != NULL)
            g_string_free(curr_key->key, TRUE);
        if (curr_key->ssid != NULL)
        g_byte_array_free(curr_key->ssid, TRUE);
        g_free(curr_key);
        curr_key = NULL;
    }
    g_list_free(list);
    return;
}