apps/x509.c:1011: error: MEMORY_LEAK
  memory dynamically allocated by call to `X509_STORE_CTX_new()` at line 960, column 11 is not reachable after line 1011, column 5.
Showing all 72 steps of the trace


apps/x509.c:941:1: start of procedure x509_certify()
939.   }
940.   
941. > static int x509_certify(X509_STORE *ctx, const char *CAfile, const EVP_MD *digest,
942.                           X509 *x, X509 *xca, EVP_PKEY *pkey,
943.                           STACK_OF(OPENSSL_STRING) *sigopts,

apps/x509.c:948:5: 
946.                           ASN1_INTEGER *sno, int reqfile)
947.   {
948. >     int ret = 0;
949.       ASN1_INTEGER *bs = NULL;
950.       X509_STORE_CTX *xsc = NULL;

apps/x509.c:949:5: 
947.   {
948.       int ret = 0;
949. >     ASN1_INTEGER *bs = NULL;
950.       X509_STORE_CTX *xsc = NULL;
951.       EVP_PKEY *upkey;

apps/x509.c:950:5: 
948.       int ret = 0;
949.       ASN1_INTEGER *bs = NULL;
950. >     X509_STORE_CTX *xsc = NULL;
951.       EVP_PKEY *upkey;
952.   

apps/x509.c:953:5: 
951.       EVP_PKEY *upkey;
952.   
953. >     upkey = X509_get0_pubkey(xca);
954.       if (upkey == NULL) {
955.           BIO_printf(bio_err, "Error obtaining CA X509 public key\n");

crypto/x509/x509_cmp.c:265:1: start of procedure X509_get0_pubkey()
  263.   }
  264.   
  265. > EVP_PKEY *X509_get0_pubkey(const X509 *x)
  266.   {
  267.       if (x == NULL)

crypto/x509/x509_cmp.c:267:9: Taking false branch
  265.   EVP_PKEY *X509_get0_pubkey(const X509 *x)
  266.   {
  267.       if (x == NULL)
                 ^
  268.           return NULL;
  269.       return X509_PUBKEY_get0(x->cert_info.key);

crypto/x509/x509_cmp.c:269:5: Skipping X509_PUBKEY_get0(): empty list of specs
  267.       if (x == NULL)
  268.           return NULL;
  269.       return X509_PUBKEY_get0(x->cert_info.key);
             ^
  270.   }
  271.   

crypto/x509/x509_cmp.c:270:1: return from a call to X509_get0_pubkey
  268.           return NULL;
  269.       return X509_PUBKEY_get0(x->cert_info.key);
  270. > }
  271.   
  272.   EVP_PKEY *X509_get_pubkey(X509 *x)

apps/x509.c:954:9: Taking false branch
952.   
953.       upkey = X509_get0_pubkey(xca);
954.       if (upkey == NULL) {
               ^
955.           BIO_printf(bio_err, "Error obtaining CA X509 public key\n");
956.           goto end;

apps/x509.c:958:5: 
956.           goto end;
957.       }
958. >     EVP_PKEY_copy_parameters(upkey, pkey);
959.   
960.       xsc = X509_STORE_CTX_new();

crypto/evp/p_lib.c:73:1: start of procedure EVP_PKEY_copy_parameters()
  71.   }
  72.   
  73. > int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from)
  74.   {
  75.       if (to->type == EVP_PKEY_NONE) {

crypto/evp/p_lib.c:75:9: Taking false branch
  73.   int EVP_PKEY_copy_parameters(EVP_PKEY *to, const EVP_PKEY *from)
  74.   {
  75.       if (to->type == EVP_PKEY_NONE) {
                ^
  76.           if (EVP_PKEY_set_type(to, from->type) == 0)
  77.               return 0;

crypto/evp/p_lib.c:78:16: Taking true branch
  76.           if (EVP_PKEY_set_type(to, from->type) == 0)
  77.               return 0;
  78.       } else if (to->type != from->type) {
                       ^
  79.           EVPerr(EVP_F_EVP_PKEY_COPY_PARAMETERS, EVP_R_DIFFERENT_KEY_TYPES);
  80.           goto err;

crypto/evp/p_lib.c:79:9: Skipping ERR_put_error(): empty list of specs
  77.               return 0;
  78.       } else if (to->type != from->type) {
  79.           EVPerr(EVP_F_EVP_PKEY_COPY_PARAMETERS, EVP_R_DIFFERENT_KEY_TYPES);
                ^
  80.           goto err;
  81.       }

crypto/evp/p_lib.c:97:2: 
  95.       if (from->ameth && from->ameth->param_copy)
  96.           return from->ameth->param_copy(to, from);
  97. >  err:
  98.       return 0;
  99.   }

crypto/evp/p_lib.c:98:5: 
  96.           return from->ameth->param_copy(to, from);
  97.    err:
  98. >     return 0;
  99.   }
  100.   

crypto/evp/p_lib.c:99:1: return from a call to EVP_PKEY_copy_parameters
  97.    err:
  98.       return 0;
  99. > }
  100.   
  101.   int EVP_PKEY_missing_parameters(const EVP_PKEY *pkey)

apps/x509.c:960:5: 
958.       EVP_PKEY_copy_parameters(upkey, pkey);
959.   
960. >     xsc = X509_STORE_CTX_new();
961.       if (xsc == NULL || !X509_STORE_CTX_init(xsc, ctx, x, NULL)) {
962.           BIO_printf(bio_err, "Error initialising X509 store\n");

crypto/x509/x509_vfy.c:2200:1: start of procedure X509_STORE_CTX_new()
  2198.   }
  2199.   
  2200. > X509_STORE_CTX *X509_STORE_CTX_new(void)
  2201.   {
  2202.       X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));

crypto/x509/x509_vfy.c:2202:5: 
  2200.   X509_STORE_CTX *X509_STORE_CTX_new(void)
  2201.   {
  2202. >     X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
  2203.   
  2204.       if (ctx == NULL) {

crypto/mem.c:98:1: start of procedure CRYPTO_zalloc()
    96.   }
    97.   
    98. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    99.   {
    100.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:100:5: 
    98.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    99.   {
    100. >     void *ret = CRYPTO_malloc(num, file, line);
    101.   
    102.       if (ret != NULL)

crypto/mem.c:71:1: start of procedure CRYPTO_malloc()
      69.   }
      70.   
      71. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      72.   {
      73.       void *ret = NULL;

crypto/mem.c:73:5: 
      71.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      72.   {
      73. >     void *ret = NULL;
      74.   
      75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:75:9: Taking false branch
      73.       void *ret = NULL;
      74.   
      75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                    ^
      76.           return malloc_impl(num, file, line);
      77.   

crypto/mem.c:78:9: Taking false branch
      76.           return malloc_impl(num, file, line);
      77.   
      78.       if (num <= 0)
                    ^
      79.           return NULL;
      80.   

crypto/mem.c:81:5: 
      79.           return NULL;
      80.   
      81. >     allow_customize = 0;
      82.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      83.       if (call_malloc_debug) {

crypto/mem.c:91:5: 
      89.       }
      90.   #else
      91. >     osslargused(file); osslargused(line);
      92.       ret = malloc(num);
      93.   #endif

crypto/mem.c:91:24: 
      89.       }
      90.   #else
      91. >     osslargused(file); osslargused(line);
      92.       ret = malloc(num);
      93.   #endif

crypto/mem.c:92:5: 
      90.   #else
      91.       osslargused(file); osslargused(line);
      92. >     ret = malloc(num);
      93.   #endif
      94.   

crypto/mem.c:95:5: 
      93.   #endif
      94.   
      95. >     return ret;
      96.   }
      97.   

crypto/mem.c:96:1: return from a call to CRYPTO_malloc
      94.   
      95.       return ret;
      96. > }
      97.   
      98.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:102:9: Taking true branch
    100.       void *ret = CRYPTO_malloc(num, file, line);
    101.   
    102.       if (ret != NULL)
                   ^
    103.           memset(ret, 0, num);
    104.       return ret;

crypto/mem.c:103:9: 
    101.   
    102.       if (ret != NULL)
    103. >         memset(ret, 0, num);
    104.       return ret;
    105.   }

crypto/mem.c:104:5: 
    102.       if (ret != NULL)
    103.           memset(ret, 0, num);
    104. >     return ret;
    105.   }
    106.   

crypto/mem.c:105:1: return from a call to CRYPTO_zalloc
    103.           memset(ret, 0, num);
    104.       return ret;
    105. > }
    106.   
    107.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/x509/x509_vfy.c:2204:9: Taking false branch
  2202.       X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
  2203.   
  2204.       if (ctx == NULL) {
                  ^
  2205.           X509err(X509_F_X509_STORE_CTX_NEW, ERR_R_MALLOC_FAILURE);
  2206.           return NULL;

crypto/x509/x509_vfy.c:2208:5: 
  2206.           return NULL;
  2207.       }
  2208. >     return ctx;
  2209.   }
  2210.   

crypto/x509/x509_vfy.c:2209:1: return from a call to X509_STORE_CTX_new
  2207.       }
  2208.       return ctx;
  2209. > }
  2210.   
  2211.   void X509_STORE_CTX_free(X509_STORE_CTX *ctx)

apps/x509.c:961:9: Taking false branch
959.   
960.       xsc = X509_STORE_CTX_new();
961.       if (xsc == NULL || !X509_STORE_CTX_init(xsc, ctx, x, NULL)) {
               ^
962.           BIO_printf(bio_err, "Error initialising X509 store\n");
963.           goto end;

apps/x509.c:961:25: Taking false branch
959.   
960.       xsc = X509_STORE_CTX_new();
961.       if (xsc == NULL || !X509_STORE_CTX_init(xsc, ctx, x, NULL)) {
                               ^
962.           BIO_printf(bio_err, "Error initialising X509 store\n");
963.           goto end;

apps/x509.c:965:9: Taking true branch
963.           goto end;
964.       }
965.       if (sno)
               ^
966.           bs = sno;
967.       else if ((bs = x509_load_serial(CAfile, serialfile, create)) == NULL)

apps/x509.c:966:9: 
964.       }
965.       if (sno)
966. >         bs = sno;
967.       else if ((bs = x509_load_serial(CAfile, serialfile, create)) == NULL)
968.           goto end;

apps/x509.c:974:5: 
972.        * certificate request in which case it is not.
973.        */
974. >     X509_STORE_CTX_set_cert(xsc, x);
975.       X509_STORE_CTX_set_flags(xsc, X509_V_FLAG_CHECK_SS_SIGNATURE);
976.       if (!reqfile && X509_verify_cert(xsc) <= 0)

crypto/x509/x509_vfy.c:2109:1: start of procedure X509_STORE_CTX_set_cert()
  2107.   }
  2108.   
  2109. > void X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx, X509 *x)
  2110.   {
  2111.       ctx->cert = x;

crypto/x509/x509_vfy.c:2111:5: 
  2109.   void X509_STORE_CTX_set_cert(X509_STORE_CTX *ctx, X509 *x)
  2110.   {
  2111. >     ctx->cert = x;
  2112.   }
  2113.   

crypto/x509/x509_vfy.c:2112:1: return from a call to X509_STORE_CTX_set_cert
  2110.   {
  2111.       ctx->cert = x;
  2112. > }
  2113.   
  2114.   void X509_STORE_CTX_set0_crls(X509_STORE_CTX *ctx, STACK_OF(X509_CRL) *sk)

apps/x509.c:975:5: 
973.        */
974.       X509_STORE_CTX_set_cert(xsc, x);
975. >     X509_STORE_CTX_set_flags(xsc, X509_V_FLAG_CHECK_SS_SIGNATURE);
976.       if (!reqfile && X509_verify_cert(xsc) <= 0)
977.           goto end;

crypto/x509/x509_vfy.c:2400:1: start of procedure X509_STORE_CTX_set_flags()
  2398.   }
  2399.   
  2400. > void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags)
  2401.   {
  2402.       X509_VERIFY_PARAM_set_flags(ctx->param, flags);

crypto/x509/x509_vfy.c:2402:5: 
  2400.   void X509_STORE_CTX_set_flags(X509_STORE_CTX *ctx, unsigned long flags)
  2401.   {
  2402. >     X509_VERIFY_PARAM_set_flags(ctx->param, flags);
  2403.   }
  2404.   

crypto/x509/x509_vpm.c:289:1: start of procedure X509_VERIFY_PARAM_set_flags()
    287.   }
    288.   
    289. > int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags)
    290.   {
    291.       param->flags |= flags;

crypto/x509/x509_vpm.c:291:5: 
    289.   int X509_VERIFY_PARAM_set_flags(X509_VERIFY_PARAM *param, unsigned long flags)
    290.   {
    291. >     param->flags |= flags;
    292.       if (flags & X509_V_FLAG_POLICY_MASK)
    293.           param->flags |= X509_V_FLAG_POLICY_CHECK;

crypto/x509/x509_vpm.c:292:9: Taking false branch
    290.   {
    291.       param->flags |= flags;
    292.       if (flags & X509_V_FLAG_POLICY_MASK)
                   ^
    293.           param->flags |= X509_V_FLAG_POLICY_CHECK;
    294.       return 1;

crypto/x509/x509_vpm.c:294:5: 
    292.       if (flags & X509_V_FLAG_POLICY_MASK)
    293.           param->flags |= X509_V_FLAG_POLICY_CHECK;
    294. >     return 1;
    295.   }
    296.   

crypto/x509/x509_vpm.c:295:1: return from a call to X509_VERIFY_PARAM_set_flags
    293.           param->flags |= X509_V_FLAG_POLICY_CHECK;
    294.       return 1;
    295. > }
    296.   
    297.   int X509_VERIFY_PARAM_clear_flags(X509_VERIFY_PARAM *param,

crypto/x509/x509_vfy.c:2403:1: return from a call to X509_STORE_CTX_set_flags
  2401.   {
  2402.       X509_VERIFY_PARAM_set_flags(ctx->param, flags);
  2403. > }
  2404.   
  2405.   void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags,

apps/x509.c:976:10: Taking true branch
974.       X509_STORE_CTX_set_cert(xsc, x);
975.       X509_STORE_CTX_set_flags(xsc, X509_V_FLAG_CHECK_SS_SIGNATURE);
976.       if (!reqfile && X509_verify_cert(xsc) <= 0)
                ^
977.           goto end;
978.   

apps/x509.c:976:21: Taking true branch
974.       X509_STORE_CTX_set_cert(xsc, x);
975.       X509_STORE_CTX_set_flags(xsc, X509_V_FLAG_CHECK_SS_SIGNATURE);
976.       if (!reqfile && X509_verify_cert(xsc) <= 0)
                           ^
977.           goto end;
978.   

apps/x509.c:1010:2: 
1008.           goto end;
1009.       ret = 1;
1010. >  end:
1011.       X509_STORE_CTX_free(xsc);
1012.       if (!ret)

apps/x509.c:1011:5: 
1009.       ret = 1;
1010.    end:
1011. >     X509_STORE_CTX_free(xsc);
1012.       if (!ret)
1013.           ERR_print_errors(bio_err);

crypto/x509/x509_vfy.c:2211:1: start of procedure X509_STORE_CTX_free()
  2209.   }
  2210.   
  2211. > void X509_STORE_CTX_free(X509_STORE_CTX *ctx)
  2212.   {
  2213.       if (ctx == NULL)

crypto/x509/x509_vfy.c:2213:9: Taking false branch
  2211.   void X509_STORE_CTX_free(X509_STORE_CTX *ctx)
  2212.   {
  2213.       if (ctx == NULL)
                  ^
  2214.           return;
  2215.   

crypto/x509/x509_vfy.c:2216:5: Skipping X509_STORE_CTX_cleanup(): empty list of specs
  2214.           return;
  2215.   
  2216.       X509_STORE_CTX_cleanup(ctx);
              ^
  2217.       OPENSSL_free(ctx);
  2218.   }

crypto/x509/x509_vfy.c:2217:5: 
  2215.   
  2216.       X509_STORE_CTX_cleanup(ctx);
  2217. >     OPENSSL_free(ctx);
  2218.   }
  2219.   

crypto/mem.c:163:1: start of procedure CRYPTO_free()
    161.   }
    162.   
    163. > void CRYPTO_free(void *str, const char *file, int line)
    164.   {
    165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:165:9: Taking true branch
    163.   void CRYPTO_free(void *str, const char *file, int line)
    164.   {
    165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    166.           free_impl(str, file, line);
    167.           return;

crypto/mem.c:165:30: Taking true branch
    163.   void CRYPTO_free(void *str, const char *file, int line)
    164.   {
    165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    166.           free_impl(str, file, line);
    167.           return;

crypto/mem.c:166:9: Skipping __function_pointer__(): unresolved function pointer
    164.   {
    165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    166.           free_impl(str, file, line);
                   ^
    167.           return;
    168.       }

crypto/mem.c:167:9: 
    165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    166.           free_impl(str, file, line);
    167. >         return;
    168.       }
    169.   

crypto/mem.c:181:1: return from a call to CRYPTO_free
    179.       free(str);
    180.   #endif
    181. > }
    182.   
    183.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/x509/x509_vfy.c:2218:1: return from a call to X509_STORE_CTX_free
  2216.       X509_STORE_CTX_cleanup(ctx);
  2217.       OPENSSL_free(ctx);
  2218. > }
  2219.   
  2220.   int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509,
