diff --git a/gvc-mixer-card.c b/gvc-mixer-card.c index fbc29f6..90ede98 100644 --- a/gvc-mixer-card.c +++ b/gvc-mixer-card.c @@ -315,6 +315,15 @@ gvc_mixer_card_profile_compare (GvcMixerCardProfile *a, return -1; } +static void +free_profile (GvcMixerCardProfile *p) +{ + g_free (p->profile); + g_free (p->human_profile); + g_free (p->status); + g_free (p); +} + /** * gvc_mixer_card_set_profiles: * @profiles: (transfer full) (element-type GvcMixerCardProfile): @@ -324,8 +333,8 @@ gvc_mixer_card_set_profiles (GvcMixerCard *card, GList *profiles) { g_return_val_if_fail (GVC_IS_MIXER_CARD (card), FALSE); - g_return_val_if_fail (card->priv->profiles == NULL, FALSE); + g_list_free_full (card->priv->profiles, (GDestroyNotify) free_profile); card->priv->profiles = g_list_sort (profiles, (GCompareFunc) gvc_mixer_card_profile_compare); return TRUE; @@ -530,15 +539,6 @@ gvc_mixer_card_new (pa_context *context, return GVC_MIXER_CARD (object); } -static void -free_profile (GvcMixerCardProfile *p) -{ - g_free (p->profile); - g_free (p->human_profile); - g_free (p->status); - g_free (p); -} - static void gvc_mixer_card_finalize (GObject *object) {