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

Sudarshan Bisht sudarshan.bisht at nokia.com
Thu May 5 13:59:43 CEST 2011


On Wed, 2011-05-04 at 11:53 +0200, ext Takashi Iwai wrote:
> At Wed,  4 May 2011 12:46:00 +0300,
> sudarshan.bisht at nokia.com wrote:
> > 
> > diff --git a/src/conf.c b/src/conf.c
> > index ddefff6..842e5e3 100644
> > --- a/src/conf.c
> > +++ b/src/conf.c
> > @@ -638,6 +638,7 @@ static int get_char_skip_comments(input_t *input)
> >  			fd = malloc(sizeof(*fd));
> >  			if (!fd) {
> >  				free(str);
> > +				snd_input_close(in);
> >  				return -ENOMEM;
> >  			}
> >  			fd->name = str;
> 
> I don't think this is correct.  The close should be never called
> during the operation in the library function.
Ok,
> 
> 
> > diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c
> > index bfa1cc8..adba7c0 100644
> > --- a/src/pcm/pcm_file.c
> > +++ b/src/pcm/pcm_file.c
> > @@ -226,7 +226,9 @@ static int snd_pcm_file_open_output_file(snd_pcm_file_t *file)
> >  					file->final_fname);
> >  			return -errno;
> >  		}
> > -		fd = fileno(pipe);
> > +		fd = dup(fileno(pipe));
> > +		if (fd >= 0)
> > +			fclose(pipe);
> 
> The error handling is missing?
Yes, in case of fd having value less then 0. 

> thanks,
> 
> Takashi




More information about the Alsa-devel mailing list