Do not leak the 'tag' when trying to read a truncated ed25519 key file

Fix for bug 18956.
This commit is contained in:
Nick Mathewson 2016-05-03 12:52:29 -04:00
parent 5b91e70a4f
commit ec81329339
2 changed files with 7 additions and 0 deletions

5
changes/bug18956 Normal file
View File

@ -0,0 +1,5 @@
o Minor bugfixes (memory leaks):
- Fix a small, uncommon memory leak that could occur when reading a
truncated ed25519 key file. Fixes bug 18956; bugfix on 0.2.6.1-alpha.

View File

@ -433,6 +433,7 @@ ed25519_seckey_read_from_file(ed25519_secret_key_t *seckey_out,
errno = EINVAL; errno = EINVAL;
} }
tor_free(*tag_out);
return -1; return -1;
} }
@ -472,6 +473,7 @@ ed25519_pubkey_read_from_file(ed25519_public_key_t *pubkey_out,
errno = EINVAL; errno = EINVAL;
} }
tor_free(*tag_out);
return -1; return -1;
} }