icmstream mem leak fix
Mike McCormack
mike at codeweavers.com
Tue Nov 30 01:32:59 CST 2004
James Hawkins wrote:
> 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?
Actually, the current code will work correctly. My nitpick is only that
you should use Release() instead of free() on an interface pointer.
Mike
-------------- next part --------------
Index: dlls/avifil32/acmstream.c
===================================================================
RCS file: /home/wine/wine/dlls/avifil32/acmstream.c,v
retrieving revision 1.14
diff -u -r1.14 acmstream.c
--- dlls/avifil32/acmstream.c 5 Oct 2004 18:10:21 -0000 1.14
+++ dlls/avifil32/acmstream.c 30 Nov 2004 08:21:29 -0000
@@ -118,10 +118,10 @@
return AVIERR_MEMORY;
pstream->lpVtbl = &iacmst;
+ pstream->ref = 1;
hr = IAVIStream_QueryInterface((IAVIStream*)pstream, riid, ppv);
- if (FAILED(hr))
- LocalFree((HLOCAL)pstream);
+ IAVIStream_Release((IAVIStream*)pstream);
return hr;
}
More information about the wine-devel
mailing list