mirror of
https://github.com/wolfSSL/wolfssl.git
synced 2025-08-02 04:04:39 +02:00
avoid use after free in error case
This commit is contained in:
3
src/pk.c
3
src/pk.c
@@ -360,8 +360,7 @@ static int der_to_enc_pem_alloc(unsigned char* der, int derSz,
|
|||||||
DYNAMIC_TYPE_TMP_BUFFER);
|
DYNAMIC_TYPE_TMP_BUFFER);
|
||||||
if (tmpBuf == NULL) {
|
if (tmpBuf == NULL) {
|
||||||
WOLFSSL_ERROR_MSG("Extending DER buffer failed");
|
WOLFSSL_ERROR_MSG("Extending DER buffer failed");
|
||||||
XFREE(der, NULL, DYNAMIC_TYPE_TMP_BUFFER);
|
ret = 0; /* der buffer is free'd at the end of the function */
|
||||||
ret = 0;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
der = tmpBuf;
|
der = tmpBuf;
|
||||||
|
Reference in New Issue
Block a user