tizen 2.3.1 release
[external/alsa-lib.git] / src / pcm / pcm_rate.c
index 70e30e5..eb35e4a 100644 (file)
@@ -1392,11 +1392,13 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
        } else {
                SNDERR("Invalid type for rate converter");
                snd_pcm_close(pcm);
+               free(rate);
                return -EINVAL;
        }
        if (err < 0) {
                SNDERR("Cannot find rate converter");
                snd_pcm_close(pcm);
+               free(rate);
                return -ENOENT;
        }
 #else
@@ -1405,6 +1407,7 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
        err = open_func(SND_PCM_RATE_PLUGIN_VERSION, &rate->obj, &rate->ops);
        if (err < 0) {
                snd_pcm_close(pcm);
+               free(rate);
                return err;
        }
 #endif
@@ -1413,6 +1416,7 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
            ! rate->ops.input_frames || ! rate->ops.output_frames) {
                SNDERR("Inproper rate plugin %s initialization", type);
                snd_pcm_close(pcm);
+               free(rate);
                return err;
        }