Commit 419af7e0 authored by Jean-Baptiste Kempf's avatar Jean-Baptiste Kempf

WinRT: release the CryptographicBufferStatics and Buffer instances

parent 86de045d
......@@ -78,12 +78,18 @@ void vlc_rand_bytes (void *buf, size_t len)
IBuffer *buffer = NULL;
hr = ICryptographicBufferStatics_GenerateRandom(cryptoStatics, len, &buffer);
if (hr)
if (hr) {
ICryptographicBufferStatics_Release(cryptoStatics);
return;
}
UINT32 olength;
unsigned char *rnd = NULL;
hr = ICryptographicBufferStatics_CopyToByteArray(cryptoStatics, buffer, &olength, (BYTE**)&rnd);
memcpy(buf, rnd, len);
IBuffer_Release(buffer);
ICryptographicBufferStatics_Release(cryptoStatics);
#else
HCRYPTPROV hProv;
/* acquire default encryption context */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment