]> git.alsa-project.org Git - alsa-lib.git/commitdiff
Fix the error path of snd_pcm_hook_add_conf()
authorTakashi Iwai <tiwai@suse.de>
Tue, 25 Apr 2006 15:32:23 +0000 (17:32 +0200)
committerTakashi Iwai <tiwai@suse.de>
Tue, 25 Apr 2006 15:32:23 +0000 (17:32 +0200)
Fixed the segfault in the error path of snd_pcm_hook_add_conf()
(calling invalid install_func pointer).
Also, added the missing snd_dlclose() to release the handle properly.

src/pcm/pcm_hooks.c

index 86799877cfb6f0d5073f4d1352a6500097ef4c56..ef44c02b63377828f180fda4ca1d0fbd645d85c3 100644 (file)
@@ -397,16 +397,18 @@ static int snd_pcm_hook_add_conf(snd_pcm_t *pcm, snd_config_t *root, snd_config_
        _err:
        if (type)
                snd_config_delete(type);
-       if (err >= 0 && args && snd_config_get_string(args, &str) >= 0) {
-               err = snd_config_search_definition(root, "hook_args", str, &args);
-               if (err < 0) {
-                       SNDERR("unknown hook_args %s", str);
-               } else {
-                       err = install_func(pcm, args);
+       if (err >= 0) {
+               if (args && snd_config_get_string(args, &str) >= 0) {
+                       err = snd_config_search_definition(root, "hook_args", str, &args);
+                       if (err < 0)
+                               SNDERR("unknown hook_args %s", str);
+                       else
+                               err = install_func(pcm, args);
                        snd_config_delete(args);
-               }
-       } else
-               err = install_func(pcm, args);
+               } else
+                       err = install_func(pcm, args);
+               snd_dlclose(h);
+       }
        if (err < 0)
                return err;
        return 0;