==1461== 8 bytes in 1 blocks are possibly lost in loss record 178 of 3,995 ==1461== at 0x7BC6F0DA: notify_alloc (heap.c:260) ==1461== by 0x7BC731BB: RtlAllocateHeap (heap.c:1725) ==1461== by 0x7B04CEC2: LocalAlloc (memory.c:606) ==1461== by 0x7B04CD6A: GlobalAlloc (memory.c:570) ==1461== by 0x5D9FC30: CreateStreamOnHGlobal (hglobalstream.c:600) ==1461== by 0x20580F06: domdoc_load_from_stream (domdoc.c:780)
Hi,
This looks good, thank you. Few comments below.
Signed-off-by: yaoyongjie yaoyongjie@uniontech.com
Please make your name in this line match From: in your email.
hr = GetHGlobalFromStream(hstream, &hglobal); if (FAILED(hr)) + { + IStream_Release(hstream); return hr; + }
This won't fail in practice, but I'm fine with keeping it obvious.
@@ -807,10 +810,12 @@ static HRESULT domdoc_load_from_stream(domdoc *doc, ISequentialStream *stream) if (!xmldoc) { + IStream_Release(hstream); ERR("Failed to parse xml\n"); return E_FAIL; } + IStream_Release(hstream); xmldoc->_private = create_priv();
It has to be released on all paths, so let's have IStream_Release() right after GlobalUnlock(hglobal).