diff --git a/src/pulsecore/card.c b/src/pulsecore/card.c index ec4a50c52..8e29f0a58 100644 --- a/src/pulsecore/card.c +++ b/src/pulsecore/card.c @@ -165,10 +165,12 @@ void pa_card_free(pa_card *c) { pa_assert(pa_idxset_isempty(c->sources)); pa_idxset_free(c->sources, NULL, NULL); - while ((profile = pa_hashmap_steal_first(c->profiles))) - pa_card_profile_free(profile); + if (c->profiles) { + while ((profile = pa_hashmap_steal_first(c->profiles))) + pa_card_profile_free(profile); - pa_hashmap_free(c->profiles, NULL, NULL); + pa_hashmap_free(c->profiles, NULL, NULL); + } pa_proplist_free(c->proplist); pa_xfree(c->driver);