]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
avoid memory leak on gnutls_x509_privkey_generate() failure
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Fri, 17 Oct 2014 07:45:07 +0000 (09:45 +0200)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Fri, 17 Oct 2014 07:45:07 +0000 (09:45 +0200)
lib/x509/privkey.c

index f5855ab638eae863b51880c221d321cf41f0241e..a08f3e5acbdc72bf21cac4bf68898872e960426b 100644 (file)
@@ -1437,7 +1437,7 @@ gnutls_x509_privkey_generate(gnutls_x509_privkey_t key,
        ret = _gnutls_pk_generate_keys(algo, bits, &key->params);
        if (ret < 0) {
                gnutls_assert();
-               return ret;
+               goto cleanup;
        }
 
 #ifndef ENABLE_FIPS140
@@ -1447,7 +1447,7 @@ gnutls_x509_privkey_generate(gnutls_x509_privkey_t key,
 #endif
        if (ret < 0) {
                gnutls_assert();
-               return ret;
+               goto cleanup;
        }
 
        ret = _gnutls_asn1_encode_privkey(algo, &key->key, &key->params);