Fix memory leak and print out keygen errors.
authorDr. Stephen Henson <steve@openssl.org>
Mon, 25 Jan 2016 16:59:19 +0000 (16:59 +0000)
committerDr. Stephen Henson <steve@openssl.org>
Mon, 1 Feb 2016 15:11:18 +0000 (15:11 +0000)
Reviewed-by: Rich Salz <rsalz@openssl.org>
apps/ecparam.c

index 122125e..b90247c 100644 (file)
@@ -462,11 +462,17 @@ int ecparam_main(int argc, char **argv)
 
         assert(need_rand);
 
-        if (EC_KEY_set_group(eckey, group) == 0)
+        if (EC_KEY_set_group(eckey, group) == 0) {
+            BIO_printf(bio_err, "unable to set group when generating key\n");
+            EC_KEY_free(eckey);
+            ERR_print_errors(bio_err);
             goto end;
+        }
 
         if (!EC_KEY_generate_key(eckey)) {
+            BIO_printf(bio_err, "unable to generate key\n");
             EC_KEY_free(eckey);
+            ERR_print_errors(bio_err);
             goto end;
         }
         assert(private);