Fix memory leak

It should have freed them when != NULL, not when == NULL.

Reviewed-by: Kurt Roeckx <kurt@roeckx.be>
Reviewed-by: Viktor Dukhovni <openssl-users@dukhovni.org>
This commit is contained in:
Rich Salz 2015-04-11 16:53:27 +02:00 committed by Kurt Roeckx
parent 8ec5c5dd36
commit a38537721d

View file

@ -133,12 +133,9 @@ int ec_GFp_simple_group_init(EC_GROUP *group)
group->a = BN_new(); group->a = BN_new();
group->b = BN_new(); group->b = BN_new();
if (!group->field || !group->a || !group->b) { if (!group->field || !group->a || !group->b) {
if (!group->field) BN_free(group->field);
BN_free(group->field); BN_free(group->a);
if (!group->a) BN_free(group->b);
BN_free(group->a);
if (!group->b)
BN_free(group->b);
return 0; return 0;
} }
group->a_is_minus3 = 0; group->a_is_minus3 = 0;