[PATCH 1/5] amstream: Leave critical section on error in MediaStreamFilter::EnumPins.

Anton Baskanov baskanov at gmail.com
Wed Jun 3 11:36:43 CDT 2020


Hello Zeb, thanks for your comments, I've sent the updated patches.

On Tuesday, 2 June 2020 22:40:33 +07 you wrote:
> Hello Anton, these patches look mostly good, just a few nitpicks...
> 
> On 6/1/20 11:13 PM, Anton Baskanov wrote:
> > Signed-off-by: Anton Baskanov <baskanov at gmail.com>
> > ---
> > 
> >  dlls/amstream/filter.c | 7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/dlls/amstream/filter.c b/dlls/amstream/filter.c
> > index fb9b1d9aee..4b5e184f04 100644
> > --- a/dlls/amstream/filter.c
> > +++ b/dlls/amstream/filter.c
> > @@ -364,10 +364,16 @@ static HRESULT WINAPI
> > filter_EnumPins(IMediaStreamFilter *iface, IEnumPins **enu> 
> >      EnterCriticalSection(&filter->cs);
> >      
> >      if (!enum_pins)
> > 
> > +    {
> > +        LeaveCriticalSection(&filter->cs);
> > 
> >          return E_POINTER;
> > 
> > +    }
> > 
> >      if (!(object = heap_alloc(sizeof(*object))))
> > 
> > +    {
> > +        LeaveCriticalSection(&filter->cs);
> > 
> >          return E_OUTOFMEMORY;
> > 
> > +    }
> 
> This could be simplified a bit by just moving the call to
> EnterCriticalSection() down; we don't need to protect these calls.
> 
> >      object->IEnumPins_iface.lpVtbl = &enum_pins_vtbl;
> >      object->refcount = 1;
> > 
> > @@ -376,6 +382,7 @@ static HRESULT WINAPI
> > filter_EnumPins(IMediaStreamFilter *iface, IEnumPins **enu> 
> >      if (!(object->pins = heap_alloc(filter->nb_streams *
> >      sizeof(*object->pins)))) {
> >      
> >          heap_free(object);
> > 
> > +        LeaveCriticalSection(&filter->cs);
> > 
> >          return E_OUTOFMEMORY;
> >      
> >      }
> >      for (i = 0; i < filter->nb_streams; ++i)







More information about the wine-devel mailing list