Coverity 1463830: Resource leaks (RESOURCE_LEAK)
authorPauli <paul.dale@oracle.com>
Sun, 24 May 2020 21:43:45 +0000 (07:43 +1000)
committerPauli <paul.dale@oracle.com>
Mon, 25 May 2020 21:57:30 +0000 (07:57 +1000)
Reviewed-by: Tim Hudson <tjh@openssl.org>
Reviewed-by: Bernd Edlinger <bernd.edlinger@hotmail.de>
(Merged from https://github.com/openssl/openssl/pull/11941)

crypto/x509/x509_vfy.c

index 75c5c0e20124adab035bbd6ca705de42b5ab0cc0..1e881ccfcd5911d93bd142d47ff200c71f8a8125 100644 (file)
@@ -398,6 +398,7 @@ static STACK_OF(X509) *lookup_certs_sk(X509_STORE_CTX *ctx,
         x = sk_X509_value(ctx->other_ctx, i);
         if (X509_NAME_cmp(nm, X509_get_subject_name(x)) == 0) {
             if (!X509_up_ref(x)) {
+                sk_X509_pop_free(sk, X509_free);
                 X509err(X509_F_LOOKUP_CERTS_SK, ERR_R_INTERNAL_ERROR);
                 ctx->error = X509_V_ERR_UNSPECIFIED;
                 return NULL;