Alex Henrie alexhenrie24@gmail.com writes:
if(BCryptOpenAlgorithmProvider(&alg, BCRYPT_SHA256_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0))
goto end;
if(BCryptCreateHash(alg, &hash, NULL, 0, NULL, 0, 0))
goto end;
if(BCryptHashData(hash, (UCHAR *)file_map, size, 0))
goto end;
if(BCryptFinishHash(hash, sha, sizeof(sha), 0))
goto end;
UnmapViewOfFile(file_map);
You are leaking file_map on error.