title: CertGetNameString throws heap corruption
body: <p>CertGetNameString() throws heap corruption error randomly, using the function CertGetNameStringW() does the same</p>
  <p>LPCWSTR pszName = (LPCWSTR)malloc(cbSize * sizeof(TCHAR));<br />
  if (CertGetNameString(
  pCurrentCertContext,
  dwType,
  dwFlags,
  nullptr,
  pszName,
  cbSize))
  {}</p>