commit 43324b0e4d9835ca7bab1d8e6bc4544a708b8ea4 Author: George Kadianakis desnacked@riseup.net Date: Tue Sep 18 14:01:15 2018 +0300
Fix minor memleak in edge-case of crypto_rsa.c function. --- src/lib/crypt_ops/crypto_rsa.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/lib/crypt_ops/crypto_rsa.c b/src/lib/crypt_ops/crypto_rsa.c index c3c6db6c3..a510e1296 100644 --- a/src/lib/crypt_ops/crypto_rsa.c +++ b/src/lib/crypt_ops/crypto_rsa.c @@ -554,8 +554,10 @@ crypto_pk_read_private_key_from_filename(crypto_pk_t *env, char *buf = read_file_to_str(keyfile, 0, &st); if (!buf) return -1; - if (st.st_size > MAX_PRIVKEY_FILE_LEN) + if (st.st_size > MAX_PRIVKEY_FILE_LEN) { + tor_free(buf); return -1; + }
int rv = crypto_pk_read_private_key_from_string(env, buf, (ssize_t)st.st_size);
tor-commits@lists.torproject.org