]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Coverity 1528496: remove assignment of unused value
authorTomas Mraz <tomas@openssl.org>
Wed, 7 Jun 2023 11:33:40 +0000 (13:33 +0200)
committerTodd Short <todd.short@me.com>
Sat, 10 Jun 2023 23:23:59 +0000 (19:23 -0400)
ctx is used only within the loop and always assigned at start

crypto/asn1/i2d_evp.c

index 0d66411be8fd00ba702d13dacf7a47aa76fb8ee4..e75a8b0152394a84864b86bf313ff82c83f21595 100644 (file)
@@ -34,7 +34,6 @@ static int i2d_provided(const EVP_PKEY *a, int selection,
                         const struct type_and_structure_st *output_info,
                         unsigned char **pp)
 {
-    OSSL_ENCODER_CTX *ctx = NULL;
     int ret;
 
     for (ret = -1;
@@ -49,6 +48,7 @@ static int i2d_provided(const EVP_PKEY *a, int selection,
          */
         size_t len = INT_MAX;
         int pp_was_NULL = (pp == NULL || *pp == NULL);
+        OSSL_ENCODER_CTX *ctx;
 
         ctx = OSSL_ENCODER_CTX_new_for_pkey(a, selection,
                                             output_info->output_type,
@@ -63,7 +63,6 @@ static int i2d_provided(const EVP_PKEY *a, int selection,
                 ret = INT_MAX - (int)len;
         }
         OSSL_ENCODER_CTX_free(ctx);
-        ctx = NULL;
     }
 
     if (ret == -1)