GH354: Memory leak fixes
[openssl.git] / crypto / x509 / x509_vfy.c
index 6b1f7febff56421821f5c720293768975ec7970c..a3077b5cbc7cd955fcb835262f2ccc35b95c55d9 100644 (file)
@@ -243,7 +243,7 @@ int X509_verify_cert(X509_STORE_CTX *ctx)
         if (ctx->param->flags & X509_V_FLAG_TRUSTED_FIRST) {
             ok = ctx->get_issuer(&xtmp, ctx, x);
             if (ok < 0)
-                return ok;
+                goto end;
             /*
              * If successful for now free up cert so it will be picked up
              * again later.
@@ -341,7 +341,7 @@ int X509_verify_cert(X509_STORE_CTX *ctx)
             ok = ctx->get_issuer(&xtmp, ctx, x);
 
             if (ok < 0)
-                return ok;
+                goto end;
             if (ok == 0)
                 break;
             x = xtmp;