]> git.alsa-project.org Git - alsa-lib.git/commitdiff
PCM: Fix the invalid snd_pcm_close() calls in rate plugin
authorTakashi Iwai <tiwai@suse.de>
Wed, 10 Oct 2012 08:22:54 +0000 (10:22 +0200)
committerTakashi Iwai <tiwai@suse.de>
Wed, 10 Oct 2012 08:22:54 +0000 (10:22 +0200)
It happens in the error path, should call snd_pcm_free() instead.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/pcm/pcm_rate.c

index a15c3afdcc19a6296f0160b3c87f05877b739308..4ba8521ea394ff08ab1b4c2b34555257ce8969db 100644 (file)
@@ -1394,13 +1394,13 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
                }
        } else {
                SNDERR("Invalid type for rate converter");
-               snd_pcm_close(pcm);
+               snd_pcm_free(pcm);
                free(rate);
                return -EINVAL;
        }
        if (err < 0) {
                SNDERR("Cannot find rate converter");
-               snd_pcm_close(pcm);
+               snd_pcm_free(pcm);
                free(rate);
                return -ENOENT;
        }
@@ -1409,7 +1409,7 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
        open_func = SND_PCM_RATE_PLUGIN_ENTRY(linear);
        err = open_func(SND_PCM_RATE_PLUGIN_VERSION, &rate->obj, &rate->ops);
        if (err < 0) {
-               snd_pcm_close(pcm);
+               snd_pcm_free(pcm);
                free(rate);
                return err;
        }
@@ -1418,7 +1418,7 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
        if (! rate->ops.init || ! (rate->ops.convert || rate->ops.convert_s16) ||
            ! rate->ops.input_frames || ! rate->ops.output_frames) {
                SNDERR("Inproper rate plugin %s initialization", type);
-               snd_pcm_close(pcm);
+               snd_pcm_free(pcm);
                free(rate);
                return err;
        }