Fix memory leak
authorRich Salz <rsalz@openssl.org>
Sat, 11 Apr 2015 14:53:27 +0000 (16:53 +0200)
committerKurt Roeckx <kurt@roeckx.be>
Sat, 11 Apr 2015 18:31:29 +0000 (20:31 +0200)
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>
crypto/ec/ecp_smpl.c

index ee0c46841b259c378aa532a4f6b7820d3478eb45..2d42d34f51cb8dd580fc937b1b36b8ec72d7b82d 100644 (file)
@@ -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;