Fix leak of encryption buffer.
This commit is contained in:
parent
360c0ade66
commit
57f77e4f8e
@ -310,8 +310,10 @@ static uint8_t const *mpw_aes(bool encrypt, const uint8_t *key, const size_t key
|
|||||||
memcpy( aesBuf, buf, *bufSize );
|
memcpy( aesBuf, buf, *bufSize );
|
||||||
memset( aesBuf + *bufSize, aesSize - *bufSize, aesSize - *bufSize );
|
memset( aesBuf + *bufSize, aesSize - *bufSize, aesSize - *bufSize );
|
||||||
uint8_t *resultBuf = malloc( aesSize );
|
uint8_t *resultBuf = malloc( aesSize );
|
||||||
if (!resultBuf)
|
if (!resultBuf) {
|
||||||
|
mpw_free( &aesBuf, aesSize );
|
||||||
return NULL;
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
if (encrypt)
|
if (encrypt)
|
||||||
AES_CBC_encrypt_buffer( resultBuf, aesBuf, aesSize, key, iv );
|
AES_CBC_encrypt_buffer( resultBuf, aesBuf, aesSize, key, iv );
|
||||||
|
Loading…
Reference in New Issue
Block a user