Merge branch 'maint-0.2.8' into release-0.2.8
This commit is contained in:
commit
6520ef5478
|
@ -0,0 +1,3 @@
|
||||||
|
o Minor bugfixes (memory leak):
|
||||||
|
- Work around a memory leak in OpenSSL 1.1 when encoding public keys.
|
||||||
|
Fixes bug 20553; bugfix on 0.0.2pre8.
|
|
@ -755,14 +755,13 @@ crypto_pk_write_key_to_string_impl(crypto_pk_t *env, char **dest,
|
||||||
}
|
}
|
||||||
|
|
||||||
BIO_get_mem_ptr(b, &buf);
|
BIO_get_mem_ptr(b, &buf);
|
||||||
(void)BIO_set_close(b, BIO_NOCLOSE); /* so BIO_free doesn't free buf */
|
|
||||||
BIO_free(b);
|
|
||||||
|
|
||||||
*dest = tor_malloc(buf->length+1);
|
*dest = tor_malloc(buf->length+1);
|
||||||
memcpy(*dest, buf->data, buf->length);
|
memcpy(*dest, buf->data, buf->length);
|
||||||
(*dest)[buf->length] = 0; /* nul terminate it */
|
(*dest)[buf->length] = 0; /* nul terminate it */
|
||||||
*len = buf->length;
|
*len = buf->length;
|
||||||
BUF_MEM_free(buf);
|
|
||||||
|
BIO_free(b);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -429,12 +429,11 @@ key_to_string(EVP_PKEY *key)
|
||||||
}
|
}
|
||||||
|
|
||||||
BIO_get_mem_ptr(b, &buf);
|
BIO_get_mem_ptr(b, &buf);
|
||||||
(void) BIO_set_close(b, BIO_NOCLOSE);
|
|
||||||
BIO_free(b);
|
|
||||||
result = tor_malloc(buf->length + 1);
|
result = tor_malloc(buf->length + 1);
|
||||||
memcpy(result, buf->data, buf->length);
|
memcpy(result, buf->data, buf->length);
|
||||||
result[buf->length] = 0;
|
result[buf->length] = 0;
|
||||||
BUF_MEM_free(buf);
|
|
||||||
|
BIO_free(b);
|
||||||
|
|
||||||
RSA_free(rsa);
|
RSA_free(rsa);
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in New Issue