[PATCH] mshtml: Decrement refcount in nsWeakReference::Release (Valgrind)

Daniel Lehman dlehman25 at gmail.com
Tue Mar 21 00:56:50 CDT 2017


probably a copy and paste typo from AddRef

was incrementing count and leaking references/memory in msxml3/tests/xmlview.c

from valgrind:
24 bytes in 2 blocks are definitely lost in loss record 347 of 2,066
   at 0x7BC51685: RtlAllocateHeap (heap.c:254)
   by 0x77BC8E0: heap_alloc (mshtml_private.h:1157)
   by 0x77BC8E0: nsSupportsWeakReference_GetWeakReference (???:0)
   by 0x6BB64A55: ???

1 block was leaked for each call to test_QueryInterface (above is for 2)

Signed-off-by: Daniel Lehman <dlehman25 at gmail.com>
---
 dlls/mshtml/nsembed.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c
index e343dde..aee00e6 100644
--- a/dlls/mshtml/nsembed.c
+++ b/dlls/mshtml/nsembed.c
@@ -1204,7 +1204,7 @@ static nsrefcnt NSAPI nsWeakReference_AddRef(nsIWeakReference *iface)
 static nsrefcnt NSAPI nsWeakReference_Release(nsIWeakReference *iface)
 {
     nsWeakReference *This = impl_from_nsIWeakReference(iface);
-    LONG ref = InterlockedIncrement(&This->ref);
+    LONG ref = InterlockedDecrement(&This->ref);
 
     TRACE("(%p) ref=%d\n", This, ref);
 
-- 
2.7.4




More information about the wine-patches mailing list