diff options
author | Kazuki Yamaguchi <k@rhe.jp> | 2016-08-06 22:24:44 +0900 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2016-08-22 15:10:03 +0100 |
commit | 0110a4703608430c2131237c6afcf932a28c27ff (patch) | |
tree | fe38e7ea9588bcf3affa6afac14b4c3692caed14 /test | |
parent | 9ba6f347fedbe103a06c8fd303912b358eacb11c (diff) |
Fix a memory leak in EC_GROUP_get_ecparameters()
The variable 'buffer', allocated by EC_POINT_point2buf(), isn't
free'd on the success path.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
Diffstat (limited to 'test')
-rw-r--r-- | test/ectest.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/ectest.c b/test/ectest.c index f7e55c3b6a..0dd0ab85d8 100644 --- a/test/ectest.c +++ b/test/ectest.c @@ -1712,6 +1712,33 @@ static void nistp_tests() } # endif +static void parameter_test(void) +{ + EC_GROUP *group, *group2; + ECPARAMETERS *ecparameters; + + fprintf(stderr, "\ntesting ecparameters conversion ..."); + + group = EC_GROUP_new_by_curve_name(NID_secp112r1); + if (!group) + ABORT; + + ecparameters = EC_GROUP_get_ecparameters(group, NULL); + if (!ecparameters) + ABORT; + group2 = EC_GROUP_new_from_ecparameters(ecparameters); + if (!group2) + ABORT; + if (EC_GROUP_cmp(group, group2, NULL)) + ABORT; + + fprintf(stderr, " ok\n"); + + EC_GROUP_free(group); + EC_GROUP_free(group2); + ECPARAMETERS_free(ecparameters); +} + static const char rnd_seed[] = "string to make the random number generator think it has entropy"; @@ -1737,6 +1764,8 @@ int main(int argc, char *argv[]) /* test the internal curves */ internal_curve_test(); + parameter_test(); + #ifndef OPENSSL_NO_CRYPTO_MDEBUG if (CRYPTO_mem_leaks_fp(stderr) <= 0) return 1; |