certstore icon indicating copy to clipboard operation
certstore copied to clipboard

use LocalLock and LocalFree

Open josharian opened this issue 3 years ago • 0 comments

Ian Lance Taylor wrote in https://github.com/golang/go/issues/51726#issuecomment-1069824759:

It looks like the code that led to this issue is calling FormatMessage with the FORMAT_MESSAGE_ALLOCATE_BUFFER which does indeed allocate memory using LocalAlloc. It's then casually converting that memory to char*, which I guess is fine today but it should really be calling LocalLock, and should really be passing the original value to LocalFree.

We should probably do that.

cc @dblohm7

josharian avatar Mar 17 '22 20:03 josharian