diff --git a/crypto/cryptlib.c b/crypto/cryptlib.c index ad727edf6a1d0e13f3e6d9a0f5a714ed81c5643b..a7894ddac3fcb3e831d03ed10d2d2ca4a6bf51b6 100644 --- a/crypto/cryptlib.c +++ b/crypto/cryptlib.c @@ -205,10 +205,14 @@ int OPENSSL_isservice(void) if (_OPENSSL_isservice.p == NULL) { HANDLE mod = GetModuleHandle(NULL); + FARPROC f; + if (mod != NULL) - _OPENSSL_isservice.f = GetProcAddress(mod, "_OPENSSL_isservice"); - if (_OPENSSL_isservice.p == NULL) + f = GetProcAddress(mod, "_OPENSSL_isservice"); + if (f == NULL) _OPENSSL_isservice.p = (void *)-1; + else + _OPENSSL_isservice.f = f; } if (_OPENSSL_isservice.p != (void *)-1)