Two bugs in BasePythonReplEvaluator.DoDebugAttach


There are two clear bugs in this function.

1) An instance of type VsDebugTargetInfo2 is created, but the cbSize member is set to sizeof(VsDebugTargetInfo).

Not sure what the implication of this is in terms of execution errors, but either way it definitely looks wrong.

2) There are two calls to AllocCoTaskMem, but no calls to FreeCoTaskMem.


zturner wrote Mar 27 at 1:18 AM

Upon further investigation, I actually wonder if #2 reported above is not a bug. I think (but can't prove) that LaunchDebugTargets2 uses the memory in the targets buffer after the function returns. I have some similar code in my application, and if I free this buffer, Visual Studio will eventually crash, and if I attach a debugger to it, the callstack suggests that the COM heap has been corrupted.

zturner wrote Mar 28 at 12:18 AM