It happens in the error path, should call snd_pcm_free() instead.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
}
} 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;
}
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;
}
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;
}