ProcessBuffer: fix free call

'info' was freed before use when OPENSSL_EXTRA is defined.
This commit is contained in:
Sean Parkinson
2023-10-25 17:23:04 +10:00
parent 5da7efacc9
commit d87cd2cc05

View File

@ -7353,12 +7353,12 @@ int ProcessBuffer(WOLFSSL_CTX* ctx, const unsigned char* buff,
} }
#endif /* WOLFSSL_ENCRYPTED_KEYS && !NO_PWDBASED */ #endif /* WOLFSSL_ENCRYPTED_KEYS && !NO_PWDBASED */
#ifdef WOLFSSL_SMALL_STACK if (ret != 0) {
XFREE(info, heap, DYNAMIC_TYPE_ENCRYPTEDINFO); #ifdef WOLFSSL_SMALL_STACK
#endif XFREE(info, heap, DYNAMIC_TYPE_ENCRYPTEDINFO);
#endif
if (ret != 0)
return ret; return ret;
}
if (keyFormat == 0) { if (keyFormat == 0) {
#ifdef OPENSSL_EXTRA #ifdef OPENSSL_EXTRA
/* Reaching this point probably means that the /* Reaching this point probably means that the
@ -7366,10 +7366,17 @@ int ProcessBuffer(WOLFSSL_CTX* ctx, const unsigned char* buff,
if (info->passwd_cb) if (info->passwd_cb)
EVPerr(0, EVP_R_BAD_DECRYPT); EVPerr(0, EVP_R_BAD_DECRYPT);
#endif #endif
#ifdef WOLFSSL_SMALL_STACK
XFREE(info, heap, DYNAMIC_TYPE_ENCRYPTEDINFO);
#endif
WOLFSSL_ERROR(WOLFSSL_BAD_FILE); WOLFSSL_ERROR(WOLFSSL_BAD_FILE);
return WOLFSSL_BAD_FILE; return WOLFSSL_BAD_FILE;
} }
#ifdef WOLFSSL_SMALL_STACK
XFREE(info, heap, DYNAMIC_TYPE_ENCRYPTEDINFO);
#endif
(void)devId; (void)devId;
} }
else if (type == CERT_TYPE) { else if (type == CERT_TYPE) {