浏览代码

[linux] Initialize m_count for IUnknown (#2757)

The Linux adapter code includes an implementation of the IUnknown
interface that contains m_count to keep track of the reference counts.
That variable is used extensively, but is not initialized.

Complaints about use before initialization due to this make up the
overwhelming majority of the complaints Valgrind makes against DXC on
Linux. Adding a constructor makes IUnknown no longer an interface,
but the build doesn't seem to care.
Greg Roth 5 年之前
父节点
当前提交
1809c25dce
共有 1 个文件被更改,包括 1 次插入0 次删除
  1. 1 0
      include/dxc/Support/WinAdapter.h

+ 1 - 0
include/dxc/Support/WinAdapter.h

@@ -592,6 +592,7 @@ template <typename T> inline void **IID_PPV_ARGS_Helper(T **pp) {
 //===--------------------- COM Interfaces ---------------------------------===//
 
 struct __declspec(uuid("00000000-0000-0000-C000-000000000046")) IUnknown {
+  IUnknown() : m_count(0) {};
   virtual HRESULT QueryInterface(REFIID riid, void **ppvObject) = 0;
   virtual ULONG AddRef();
   virtual ULONG Release();