Author: cwittich
Date: Fri Sep 4 08:02:53 2015
New Revision: 68981
URL:
http://svn.reactos.org/svn/reactos?rev=68981&view=rev
Log:
[CRT] fix resource leak in error case CID 716561
Modified:
trunk/reactos/lib/sdk/crt/math/rand.c
Modified: trunk/reactos/lib/sdk/crt/math/rand.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/sdk/crt/math/rand.c?re…
==============================================================================
--- trunk/reactos/lib/sdk/crt/math/rand.c [iso-8859-1] (original)
+++ trunk/reactos/lib/sdk/crt/math/rand.c [iso-8859-1] Fri Sep 4 08:02:53 2015
@@ -34,15 +34,16 @@
{
BOOLEAN (WINAPI *pSystemFunction036)(PVOID, ULONG); // RtlGenRandom
HINSTANCE hadvapi32 = LoadLibraryA("advapi32.dll");
+ int ret = 0;
pSystemFunction036 = (void*)GetProcAddress(hadvapi32,
"SystemFunction036");
#if 1
if (!pval || (pSystemFunction036 && !pSystemFunction036(pval,
sizeof(*pval))))
{
_invalid_parameter(NULL,_CRT_WIDE("rand_s"),_CRT_WIDE(__FILE__),__LINE__, 0);
*_errno() = EINVAL;
- return EINVAL;
+ ret = EINVAL;
}
#endif
if(hadvapi32) FreeLibrary(hadvapi32);
- return 0;
+ return ret;
}