]> code.delx.au - pulseaudio/blobdiff - src/modules/alsa/alsa-mixer.c
Use pa_hashmap_remove_and_free() where appropriate
[pulseaudio] / src / modules / alsa / alsa-mixer.c
index 99de0ec1e05915d2449f32bcf43c5e13e8a8ccf0..58f91820cbe42e97bc953c6c827d520c92c538b7 100644 (file)
@@ -3776,8 +3776,8 @@ static void mapping_paths_probe(pa_alsa_mapping *m, pa_alsa_profile *profile,
     pa_assert(pcm_handle);
 
     mixer_handle = pa_alsa_open_mixer_for_pcm(pcm_handle, NULL, &hctl_handle);
-    if (!mixer_handle || !hctl_handle) {
-         /* Cannot open mixer, remove all entries */
+    if (!mixer_handle) {
+        /* Cannot open mixer, remove all entries */
         pa_hashmap_remove_all(ps->paths);
         return;
     }
@@ -4296,10 +4296,8 @@ static void paths_drop_unused(pa_hashmap* h, pa_hashmap *keep) {
 
     p = pa_hashmap_iterate(h, &state, &key);
     while (p) {
-        if (pa_hashmap_get(keep, p) == NULL) {
-            pa_hashmap_remove(h, key);
-            pa_alsa_path_free(p);
-        }
+        if (pa_hashmap_get(keep, p) == NULL)
+            pa_hashmap_remove_and_free(h, key);
         p = pa_hashmap_iterate(h, &state, &key);
     }
 }
@@ -4468,17 +4466,13 @@ void pa_alsa_profile_set_drop_unsupported(pa_alsa_profile_set *ps) {
     void *state;
 
     PA_HASHMAP_FOREACH(p, ps->profiles, state) {
-        if (!p->supported) {
-            pa_hashmap_remove(ps->profiles, p->name);
-            profile_free(p);
-        }
+        if (!p->supported)
+            pa_hashmap_remove_and_free(ps->profiles, p->name);
     }
 
     PA_HASHMAP_FOREACH(m, ps->mappings, state) {
-        if (m->supported <= 0) {
-            pa_hashmap_remove(ps->mappings, m->name);
-            mapping_free(m);
-        }
+        if (m->supported <= 0)
+            pa_hashmap_remove_and_free(ps->mappings, m->name);
     }
 }