[alsa-devel] [PATCH 1/4] src/pcm/pcm_rate.c: add missing free
From: Julia Lawall julia@diku.dk
Something that is allocated using calloc is not freed on one or more error paths.
Signed-off-by: Julia Lawall julia@diku.dk Signed-off-by: Suman Saha sumsaha@gmail.com
--- Compile-tested only.
src/pcm/pcm_rate.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c index 70e30e5..eb35e4a 100644 --- a/src/pcm/pcm_rate.c +++ b/src/pcm/pcm_rate.c @@ -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; }
At Sun, 18 Sep 2011 22:04:34 +0200, Julia Lawall wrote:
From: Julia Lawall julia@diku.dk
Something that is allocated using calloc is not freed on one or more error paths.
Signed-off-by: Julia Lawall julia@diku.dk Signed-off-by: Suman Saha sumsaha@gmail.com
Thanks, now applied patches 1, 3 and 4. (2 needs a rewrite.)
Takashi
Compile-tested only.
src/pcm/pcm_rate.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c index 70e30e5..eb35e4a 100644 --- a/src/pcm/pcm_rate.c +++ b/src/pcm/pcm_rate.c @@ -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);
return -EINVAL; } if (err < 0) { SNDERR("Cannot find rate converter"); snd_pcm_close(pcm);free(rate);
return -ENOENT; }free(rate);
#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);
return err; }free(rate);
#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);
return err; }free(rate);
Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
On Thu, 22 Sep 2011, Takashi Iwai wrote:
At Sun, 18 Sep 2011 22:04:34 +0200, Julia Lawall wrote:
From: Julia Lawall julia@diku.dk
Something that is allocated using calloc is not freed on one or more error paths.
Signed-off-by: Julia Lawall julia@diku.dk Signed-off-by: Suman Saha sumsaha@gmail.com
Thanks, now applied patches 1, 3 and 4. (2 needs a rewrite.)
Thanks for the feedback on 2. I will take care of it shortly.
julia
Takashi
Compile-tested only.
src/pcm/pcm_rate.c | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/src/pcm/pcm_rate.c b/src/pcm/pcm_rate.c index 70e30e5..eb35e4a 100644 --- a/src/pcm/pcm_rate.c +++ b/src/pcm/pcm_rate.c @@ -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);
return -EINVAL; } if (err < 0) { SNDERR("Cannot find rate converter"); snd_pcm_close(pcm);free(rate);
return -ENOENT; }free(rate);
#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);
return err; }free(rate);
#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);
return err; }free(rate);
Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
Alsa-devel mailing list Alsa-devel@alsa-project.org http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
participants (2)
-
Julia Lawall
-
Takashi Iwai