Remove PEM_read* anti-pattern that only happens to work because we're using a global variable

This commit is contained in:
Cameron Gutman 2018-04-30 21:18:56 -07:00
parent 7a54ad9fb1
commit 248a4da331

View File

@ -62,7 +62,7 @@ void MoonlightInstance::LoadCert(const char* certStr, const char* keyStr)
BIO_free_all(bio); BIO_free_all(bio);
bio = BIO_new_mem_buf(_keyStr, -1); bio = BIO_new_mem_buf(_keyStr, -1);
if(PEM_read_bio_PrivateKey(bio, &g_PrivateKey, NULL, NULL) == NULL) { if (!(g_PrivateKey = PEM_read_bio_PrivateKey(bio, NULL, NULL, NULL))) {
PostMessage(pp::Var("Error loading private key into memory")); PostMessage(pp::Var("Error loading private key into memory"));
} }
BIO_free_all(bio); BIO_free_all(bio);