icmstream mem leak fix

James Hawkins truiken at gmail.com
Tue Nov 30 01:10:39 CST 2004


Hey Mike,

Ignoring the change that I made, what is wrong with the current code? 
I kindof figured that pstream was tied into ppv, but I wanted to make
sure.  If that is the case, then my acmstream patch should be ignored
as well.  I thought to call LocalFree on pstream because it was
allocated with LocalAlloc.  Can you explain what should be written
instead so I don't make the same mistake?


On Tue, 30 Nov 2004 16:07:18 +0900, Mike McCormack <mike at codeweavers.com> wrote:
> 
> Hi James,
> 
> That looks kind of wrong, both the before and after...
> Interfaces should be released, not free'd...
> 
> Secondly, freeing the interface if the Query works is almost definitely
> wrong, because ppv will likely point to the same memory as pstream.
> 
> Mike
> 
> James Hawkins wrote:
> 
> >    hr = IAVIStream_QueryInterface((IAVIStream*)pstream, riid, ppv);
> > -  if (FAILED(hr))
> > -    LocalFree((HLOCAL)pstream);
> > +
> > +  LocalFree((HLOCAL)pstream);
> >
> >    return hr;
> >  }
> 


-- 
James Hawkins



More information about the wine-devel mailing list