In the error handling case at the end of the method we have:
buf = CreateErrorMsgFromInfo(hr, &excepInfo, nm);
and
dispIdAsName = new char[256];
and later:
if (buf) delete buf;
if (dispIdAsName) delete dispIdAsName;
The latter should be:
delete[] buf;
delete[] dispIdAsName;
to agree with how they were created, as new wchar_t[...] and new char[...] respectively.
The null tests are unnecessary.