[PATCH] winealsa.drv: Init *num to 0 (Coverity)

Andrew Eikum aeikum at codeweavers.com
Mon Apr 16 11:57:27 CDT 2012


On Mon, Apr 16, 2012 at 11:53:00AM -0500, Andrew Eikum wrote:
> On Mon, Apr 16, 2012 at 09:09:58AM +0200, Marcus Meissner wrote:
> > Also initialize a "may be uninitialized" value the compiler sees.
> > 

Of course I quoted the wrong section of your mail :)

> 
> Not sure what this means. *num is initialized at the beginning of
> alsa_enum_devices, which is always called from GetEndpointIDs. Seems
> like a Coverity oversight. I'd either leave it as-is, or also remove
> the *num=0 from alsa_enum_devices.
> 
> Andrew
> 
> > Ciao, Marcus
> > ---
> >  dlls/winealsa.drv/mmdevdrv.c |    3 ++-
> >  1 files changed, 2 insertions(+), 1 deletions(-)
> > 
> > diff --git a/dlls/winealsa.drv/mmdevdrv.c b/dlls/winealsa.drv/mmdevdrv.c
> > index e3c1d15..d84bbb2 100644
> > --- a/dlls/winealsa.drv/mmdevdrv.c
> > +++ b/dlls/winealsa.drv/mmdevdrv.c
> > @@ -345,7 +345,7 @@ static WCHAR *construct_device_id(EDataFlow flow, const WCHAR *chunk1, const cha
> >  {
> >      WCHAR *ret;
> >      const WCHAR *prefix;
> > -    DWORD len_wchars = 0, chunk1_len, copied = 0, prefix_len;
> > +    DWORD len_wchars = 0, chunk1_len = 0, copied = 0, prefix_len;
> >  
> >      static const WCHAR dashW[] = {' ','-',' ',0};
> >      static const size_t dashW_len = (sizeof(dashW) / sizeof(*dashW)) - 1;
> > @@ -583,6 +583,7 @@ HRESULT WINAPI AUDDRV_GetEndpointIDs(EDataFlow flow, WCHAR ***ids, GUID **guids,
> >  
> >      TRACE("%d %p %p %p %p\n", flow, ids, guids, num, def_index);
> >  
> > +    *num = 0;
> >      *ids = NULL;
> >      *guids = NULL;
> >  
> > -- 
> > 1.7.3.4
> > 
> > 
> > 
> 
> 



More information about the wine-devel mailing list