Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix ASAN memory leak in FileChecker (#5718)
AllocVFSIncludeHandler was returning it's IUnknown object by Detach()ing from a CComPtr, then assiging to CComPtr. This would result in the object have a ref count of 2, and when the second CComPtr destructed, it would go down to 1, and leak memory. The fix is to return the object as a CComPtr; however, with Clang, this failed to compile because it finds no conversion from a CComPtr of child class type to a CComPtr of base class type. This compiles fine on MSVC, so I debugged it, and realized that MSVC compiles this as first a conversion to T*, then a constructor call. I suspect MSVC is wrong here. In any case, this change adds a template conversion constructor to CComPtr, very much like the existing template assignment operator.
- Loading branch information