mirror of
https://github.com/jedisct1/libsodium.git
synced 2024-12-20 02:25:14 -07:00
Plug memory leak on error path in the easy interfaces
This commit is contained in:
parent
2a531bb519
commit
8a8463e4ac
@ -73,6 +73,7 @@ crypto_box_open_easy(unsigned char *m, const unsigned char *c,
|
||||
memcpy(c_boxed + crypto_box_BOXZEROBYTES, c, clen);
|
||||
m_boxed_len = c_boxed_len + crypto_box_MACBYTES;
|
||||
if ((m_boxed = (unsigned char *) malloc(m_boxed_len)) == NULL) {
|
||||
free(c_boxed);
|
||||
return -1;
|
||||
}
|
||||
rc = crypto_box_open(m_boxed, c_boxed,
|
||||
|
@ -74,6 +74,7 @@ crypto_secretbox_open_easy(unsigned char *m, const unsigned char *c,
|
||||
memcpy(c_boxed + crypto_secretbox_BOXZEROBYTES, c, clen);
|
||||
m_boxed_len = c_boxed_len + crypto_secretbox_MACBYTES;
|
||||
if ((m_boxed = (unsigned char *) malloc(m_boxed_len)) == NULL) {
|
||||
free(c_boxed);
|
||||
return -1;
|
||||
}
|
||||
rc = crypto_secretbox_open(m_boxed, c_boxed,
|
||||
|
Loading…
Reference in New Issue
Block a user