]> code.delx.au - pulseaudio/commitdiff
fix destruction when no profiles are defined
authorLennart Poettering <lennart@poettering.net>
Tue, 20 Jan 2009 02:24:40 +0000 (03:24 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 20 Jan 2009 02:24:40 +0000 (03:24 +0100)
src/pulsecore/card.c

index ec4a50c52c385d541656b5408455d4a9e71beb89..8e29f0a58a904d30cc3861fb71d9245acbb6389a 100644 (file)
@@ -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);