[alsa-devel] [PATCH 1/2] alsa-lib: fixed coverity reported issues under "USE_AFTER_FREE" checker.

Sudarshan Bisht sudarshan.bisht at nokia.com
Thu May 5 14:01:16 CEST 2011


On Wed, 2011-05-04 at 11:57 +0200, ext Takashi Iwai wrote:
> At Wed,  4 May 2011 12:46:01 +0300,
> sudarshan.bisht at nokia.com wrote:
> > 
> > From: Sudarshan Bisht <sudarshan.bisht at nokia.com>
> > 
> > Coverity Static Analysis helps developers find hard-to-spot,
> > yet potentially crash-causing defects early in the development phase,
> > reducing the cost,time, and risk of software errors.
> > 
> > This patch has fixes for 1) a junk assignment and 2) memory freed at wrong location.
> > 
> > ---
> >  modules/mixer/simple/python.c |    1 +
> >  src/control/control_hw.c      |    1 +
> >  src/mixer/mixer.c             |    1 -
> >  3 files changed, 2 insertions(+), 1 deletions(-)
> > 
> > diff --git a/modules/mixer/simple/python.c b/modules/mixer/simple/python.c
> > index c822c52..784d9a0 100644
> > --- a/modules/mixer/simple/python.c
> > +++ b/modules/mixer/simple/python.c
> > @@ -663,6 +663,7 @@ pymixer_attach_hctl(struct pymixer *pymixer, PyObject *args)
> >  		return NULL;
> >  	err = snd_mixer_attach_hctl(pymixer->mixer, hctl);
> >  	if (err < 0) {
> > +		snd_hctl_close(hctl);
> >  		PyErr_Format(PyExc_RuntimeError, "Cannot attach hctl: %s", snd_strerror(err));
> >  		return NULL;
> >  	}
> 
> This doesn't look good.
> We did close mistakenly in snd_mixer_attach_hctl() in the error case,
> and it's fixed by your patch.  But this behavior shouldn't be inherited.
> 
Sorry but I did not understand whether you want to have this fix in
patch or not ? 

> thanks,
> 
> Takashi
> _______________________________________________
> 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