[alsa-devel] [PATCH 1/4] src/pcm/pcm_rate.c: add missing free

Julia Lawall julia at diku.dk
Thu Sep 22 13:28:53 CEST 2011


On Thu, 22 Sep 2011, Takashi Iwai wrote:

> At Sun, 18 Sep 2011 22:04:34 +0200,
> Julia Lawall wrote:
> > 
> > From: Julia Lawall <julia at diku.dk>
> > 
> > Something that is allocated using calloc is not freed on one
> > or more error paths.
> > 
> > Signed-off-by: Julia Lawall <julia at diku.dk>
> > Signed-off-by: Suman Saha <sumsaha at 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);
> > +		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;
> >  	}
> >  
> > 
> > _______________________________________________
> > Alsa-devel mailing list
> > Alsa-devel at alsa-project.org
> > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> > 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel at alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 


More information about the Alsa-devel mailing list