Skip to content

Commit

Permalink
Fix memory leak
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Rich Salz authored and kroeckx committed Apr 11, 2015
1 parent 8ec5c5d commit a385377
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions crypto/ec/ecp_smpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,9 @@ int ec_GFp_simple_group_init(EC_GROUP *group)
group->a = BN_new();
group->b = BN_new();
if (!group->field || !group->a || !group->b) {
if (!group->field)
BN_free(group->field);
if (!group->a)
BN_free(group->a);
if (!group->b)
BN_free(group->b);
BN_free(group->field);
BN_free(group->a);
BN_free(group->b);
return 0;
}
group->a_is_minus3 = 0;
Expand Down

0 comments on commit a385377

Please sign in to comment.