while (profile->events != NULL) {
RTEvent *event = (RTEvent *)profile->events->data;
g_free(event->message);
g_free(event);
profile->events = g_list_delete_link(profile->events, profile->events);
}
while (profile->events != NULL) {
RTEvent *event = (RTEvent *)profile->events->data;
g_free(event->message);
g_free(event);
profile->events = g_list_delete_link(profile->events, profile->events);
}