hcrypto: w32crypto crypt provider handle leak
commitb3f29170a35a8e249cd512db682e7f4092af663e
authorJeffrey Altman <jaltman@secure-endpoints.com>
Wed, 24 Dec 2014 20:43:03 +0000 (24 15:43 -0500)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Wed, 24 Dec 2014 20:49:31 +0000 (24 15:49 -0500)
tree4786d7dbcdb2e891962fa7ccfd1ec7f167b07f68
parent0e93a04c01540abe7937b579fef111781903e754
hcrypto: w32crypto crypt provider handle leak

_hc_CryptProvider() returns a global handle to a Win32 Crypt Provider.
If the global handle is NULL, then a handle is allocated.  Unfortunately,
due to a coding mistake the global handle variable, g_cryptprovider, was
never set and a new handle was allocated with each call.

Refactor the function to ensure that the global handle is the value
that is returned.  Use NULL instead of 0 for pointer assignment.

Change-Id: If1ef3aa19cbd1d51860370db24c086e86922ff0d
lib/hcrypto/rand-w32.c