From: Takashi Iwai Date: Wed, 28 Mar 2007 12:31:46 +0000 (+0200) Subject: Fixed an access to uninitialized variable in pcm_rate.c X-Git-Tag: v1.0.14rc4~3 X-Git-Url: https://git.alsa-project.org/?a=commitdiff_plain;h=7f9dd4ac65b72bcaa784366f787fe5c622703339;p=alsa-lib.git Fixed an access to uninitialized variable in pcm_rate.c Fixed an access to uninitialized variable in pcm_rate.c (in error message). --- diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c index a1ebfdde..8e8fb06a 100644 --- a/src/pcm/pcm_rate.c +++ b/src/pcm/pcm_rate.c @@ -1322,7 +1322,7 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name, { snd_pcm_t *pcm; snd_pcm_rate_t *rate; - const char *type; + const char *type = NULL; int err; #ifndef PIC snd_pcm_rate_open_func_t open_func; @@ -1355,8 +1355,10 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name, const char **types; for (types = default_rate_plugins; *types; types++) { err = rate_open_func(rate, *types); - if (!err) + if (!err) { + type = *types; break; + } } } else if (!snd_config_get_string(converter, &type)) err = rate_open_func(rate, type); @@ -1381,6 +1383,7 @@ int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name, return -ENOENT; } #else + type = "linear"; open_func = SND_PCM_RATE_PLUGIN_ENTRY(linear); err = open_func(SND_PCM_RATE_PLUGIN_VERSION, &rate->obj, &rate->ops); if (err < 0) {