[pywin32-bugs] [ pywin32-Bugs-736517 ] Memory Leak
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2003-05-13 14:28:41
|
Bugs item #736517, was opened at 2003-05-13 01:49 Message generated for change (Comment added) made by mhammond You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=736517&group_id=78018 >Category: com Group: None Status: Open Resolution: None Priority: 5 Submitted By: Shack Toms (shacktoms) >Assigned to: Mark Hammond (mhammond) Summary: Memory Leak Initial Comment: There is a memory leak associated with events delivered through the IConnectionPoint interface. The leak occurs when a ByRef VARIANT parameter is passed through the interface as an inout parameter. The culprit appears to be oleargs.cpp, specifically the routine PythonOleArgHelper::MakeObjToVariant, which is called to replace the original VARIANT with the returned one. In the case VT_VARIANT | VT_BYREF, with bCreateBuffers as false, the routine calls VariantClear(var), which only clears the referencing VARIANT and not the referenced one. This call should be VariantClear(V_VARIANTREF(var)), which will clear memory held by the referenced VARIANT before the subsequent call to PyCom_VariantFromPyObject simply overwrites that VARIANT. The code as written depends on V_VARIANTREF(var) to remain valid after calling VariantClear(var), which seems a dangerous assumption. Note that this repair follows the same logic as is used in the existing code for the VT_BSTR | VT_BYREF case, in which SysFreeString(*V_BSTRREF(var)) is called, for the reason that VariantClear(var) wouldn't free the indirectly referenced BSTR. ---------------------------------------------------------------------- >Comment By: Mark Hammond (mhammond) Date: 2003-05-14 00:28 Message: Logged In: YES user_id=14198 Thanks! Looks right to me. I will check it in as soon as I re-run all the tests. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551954&aid=736517&group_id=78018 |