GH364: Free memory on an error path
authorIsmo Puustinen <ismo.puustinen@intel.com>
Sat, 8 Aug 2015 02:11:28 +0000 (22:11 -0400)
committerRich Salz <rsalz@openssl.org>
Thu, 13 Aug 2015 16:15:22 +0000 (12:15 -0400)
Part of RT 3997
Per Ben, just jump to common exit code.

Signed-off-by: Rich Salz <rsalz@akamai.com>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(cherry picked from commit cc2829e6641092abed8360433dbe67e883fd1cc6)

crypto/x509/x509_vfy.c

index a2f1dbefe3520a7235a996a4733f644f78272a02..26c6bb3b113a8d86324fc374a1fbe13dd3ac485f 100644 (file)
@@ -354,7 +354,8 @@ int X509_verify_cert(X509_STORE_CTX *ctx)
             if (!sk_X509_push(ctx->chain, x)) {
                 X509_free(xtmp);
                 X509err(X509_F_X509_VERIFY_CERT, ERR_R_MALLOC_FAILURE);
-                return 0;
+                ok = 0;
+                goto done;
             }
             num++;
         }