ssl/statem/statem_lib.c:915: error: MEMORY_LEAK
  memory dynamically allocated by call to `X509_STORE_CTX_new()` at line 908, column 34 is not reachable after line 915, column 13.
Showing all 49 steps of the trace


ssl/statem/statem_lib.c:878:1: start of procedure ssl_add_cert_chain()
876.   
877.   /* Add certificate chain to provided WPACKET */
878. > static int ssl_add_cert_chain(SSL *s, WPACKET *pkt, CERT_PKEY *cpk, int *al)
879.   {
880.       int i, chain_count;

ssl/statem/statem_lib.c:883:5: 
881.       X509 *x;
882.       STACK_OF(X509) *extra_certs;
883. >     STACK_OF(X509) *chain = NULL;
884.       X509_STORE *chain_store;
885.       int tmpal = SSL_AD_INTERNAL_ERROR;

ssl/statem/statem_lib.c:885:5: 
883.       STACK_OF(X509) *chain = NULL;
884.       X509_STORE *chain_store;
885. >     int tmpal = SSL_AD_INTERNAL_ERROR;
886.   
887.       if (cpk == NULL || cpk->x509 == NULL)

ssl/statem/statem_lib.c:887:9: Taking false branch
885.       int tmpal = SSL_AD_INTERNAL_ERROR;
886.   
887.       if (cpk == NULL || cpk->x509 == NULL)
               ^
888.           return 1;
889.   

ssl/statem/statem_lib.c:887:24: Taking false branch
885.       int tmpal = SSL_AD_INTERNAL_ERROR;
886.   
887.       if (cpk == NULL || cpk->x509 == NULL)
                              ^
888.           return 1;
889.   

ssl/statem/statem_lib.c:890:5: 
888.           return 1;
889.   
890. >     x = cpk->x509;
891.   
892.       /*

ssl/statem/statem_lib.c:895:9: Taking false branch
893.        * If we have a certificate specific chain use it, else use parent ctx.
894.        */
895.       if (cpk->chain != NULL)
               ^
896.           extra_certs = cpk->chain;
897.       else

ssl/statem/statem_lib.c:898:9: 
896.           extra_certs = cpk->chain;
897.       else
898. >         extra_certs = s->ctx->extra_certs;
899.   
900.       if ((s->mode & SSL_MODE_NO_AUTO_CHAIN) || extra_certs)

ssl/statem/statem_lib.c:900:10: Taking false branch
898.           extra_certs = s->ctx->extra_certs;
899.   
900.       if ((s->mode & SSL_MODE_NO_AUTO_CHAIN) || extra_certs)
                ^
901.           chain_store = NULL;
902.       else if (s->cert->chain_store)

ssl/statem/statem_lib.c:900:47: Taking false branch
898.           extra_certs = s->ctx->extra_certs;
899.   
900.       if ((s->mode & SSL_MODE_NO_AUTO_CHAIN) || extra_certs)
                                                     ^
901.           chain_store = NULL;
902.       else if (s->cert->chain_store)

ssl/statem/statem_lib.c:902:14: Taking false branch
900.       if ((s->mode & SSL_MODE_NO_AUTO_CHAIN) || extra_certs)
901.           chain_store = NULL;
902.       else if (s->cert->chain_store)
                    ^
903.           chain_store = s->cert->chain_store;
904.       else

ssl/statem/statem_lib.c:905:9: 
903.           chain_store = s->cert->chain_store;
904.       else
905. >         chain_store = s->ctx->cert_store;
906.   
907.       if (chain_store != NULL) {

ssl/statem/statem_lib.c:907:9: Taking true branch
905.           chain_store = s->ctx->cert_store;
906.   
907.       if (chain_store != NULL) {
               ^
908.           X509_STORE_CTX *xs_ctx = X509_STORE_CTX_new();
909.   

ssl/statem/statem_lib.c:908:9: 
906.   
907.       if (chain_store != NULL) {
908. >         X509_STORE_CTX *xs_ctx = X509_STORE_CTX_new();
909.   
910.           if (xs_ctx == NULL) {

crypto/x509/x509_vfy.c:2151:1: start of procedure X509_STORE_CTX_new()
  2149.   }
  2150.   
  2151. > X509_STORE_CTX *X509_STORE_CTX_new(void)
  2152.   {
  2153.       X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));

crypto/x509/x509_vfy.c:2153:5: 
  2151.   X509_STORE_CTX *X509_STORE_CTX_new(void)
  2152.   {
  2153. >     X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
  2154.   
  2155.       if (ctx == NULL) {

crypto/mem.c:218:1: start of procedure CRYPTO_zalloc()
    216.   }
    217.   
    218. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    219.   {
    220.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:220:5: 
    218.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    219.   {
    220. >     void *ret = CRYPTO_malloc(num, file, line);
    221.   
    222.       FAILTEST();

crypto/mem.c:189:1: start of procedure CRYPTO_malloc()
      187.   #endif
      188.   
      189. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      190.   {
      191.       void *ret = NULL;

crypto/mem.c:191:5: 
      189.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      190.   {
      191. >     void *ret = NULL;
      192.   
      193.       INCREMENT(malloc_count);

crypto/mem.c:194:9: Taking false branch
      192.   
      193.       INCREMENT(malloc_count);
      194.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      195.           return malloc_impl(num, file, line);
      196.   

crypto/mem.c:197:9: Taking false branch
      195.           return malloc_impl(num, file, line);
      196.   
      197.       if (num == 0)
                     ^
      198.           return NULL;
      199.   

crypto/mem.c:201:5: 
      199.   
      200.       FAILTEST();
      201. >     allow_customize = 0;
      202.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      203.       if (call_malloc_debug) {

crypto/mem.c:211:5: 
      209.       }
      210.   #else
      211. >     (void)(file); (void)(line);
      212.       ret = malloc(num);
      213.   #endif

crypto/mem.c:211:19: 
      209.       }
      210.   #else
      211. >     (void)(file); (void)(line);
      212.       ret = malloc(num);
      213.   #endif

crypto/mem.c:212:5: 
      210.   #else
      211.       (void)(file); (void)(line);
      212. >     ret = malloc(num);
      213.   #endif
      214.   

crypto/mem.c:215:5: 
      213.   #endif
      214.   
      215. >     return ret;
      216.   }
      217.   

crypto/mem.c:216:1: return from a call to CRYPTO_malloc
      214.   
      215.       return ret;
      216. > }
      217.   
      218.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:223:9: Taking true branch
    221.   
    222.       FAILTEST();
    223.       if (ret != NULL)
                   ^
    224.           memset(ret, 0, num);
    225.       return ret;

crypto/mem.c:224:9: 
    222.       FAILTEST();
    223.       if (ret != NULL)
    224. >         memset(ret, 0, num);
    225.       return ret;
    226.   }

crypto/mem.c:225:5: 
    223.       if (ret != NULL)
    224.           memset(ret, 0, num);
    225. >     return ret;
    226.   }
    227.   

crypto/mem.c:226:1: return from a call to CRYPTO_zalloc
    224.           memset(ret, 0, num);
    225.       return ret;
    226. > }
    227.   
    228.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/x509/x509_vfy.c:2155:9: Taking false branch
  2153.       X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
  2154.   
  2155.       if (ctx == NULL) {
                  ^
  2156.           X509err(X509_F_X509_STORE_CTX_NEW, ERR_R_MALLOC_FAILURE);
  2157.           return NULL;

crypto/x509/x509_vfy.c:2159:5: 
  2157.           return NULL;
  2158.       }
  2159. >     return ctx;
  2160.   }
  2161.   

crypto/x509/x509_vfy.c:2160:1: return from a call to X509_STORE_CTX_new
  2158.       }
  2159.       return ctx;
  2160. > }
  2161.   
  2162.   void X509_STORE_CTX_free(X509_STORE_CTX *ctx)

ssl/statem/statem_lib.c:910:13: Taking false branch
908.           X509_STORE_CTX *xs_ctx = X509_STORE_CTX_new();
909.   
910.           if (xs_ctx == NULL) {
                   ^
911.               SSLerr(SSL_F_SSL_ADD_CERT_CHAIN, ERR_R_MALLOC_FAILURE);
912.               goto err;

ssl/statem/statem_lib.c:914:14: Taking true branch
912.               goto err;
913.           }
914.           if (!X509_STORE_CTX_init(xs_ctx, chain_store, x, NULL)) {
                    ^
915.               X509_STORE_CTX_free(xs_ctx);
916.               SSLerr(SSL_F_SSL_ADD_CERT_CHAIN, ERR_R_X509_LIB);

ssl/statem/statem_lib.c:915:13: 
913.           }
914.           if (!X509_STORE_CTX_init(xs_ctx, chain_store, x, NULL)) {
915. >             X509_STORE_CTX_free(xs_ctx);
916.               SSLerr(SSL_F_SSL_ADD_CERT_CHAIN, ERR_R_X509_LIB);
917.               goto err;

crypto/x509/x509_vfy.c:2162:1: start of procedure X509_STORE_CTX_free()
  2160.   }
  2161.   
  2162. > void X509_STORE_CTX_free(X509_STORE_CTX *ctx)
  2163.   {
  2164.       if (ctx == NULL)

crypto/x509/x509_vfy.c:2164:9: Taking false branch
  2162.   void X509_STORE_CTX_free(X509_STORE_CTX *ctx)
  2163.   {
  2164.       if (ctx == NULL)
                  ^
  2165.           return;
  2166.   

crypto/x509/x509_vfy.c:2167:5: Skipping X509_STORE_CTX_cleanup(): empty list of specs
  2165.           return;
  2166.   
  2167.       X509_STORE_CTX_cleanup(ctx);
              ^
  2168.       OPENSSL_free(ctx);
  2169.   }

crypto/x509/x509_vfy.c:2168:5: 
  2166.   
  2167.       X509_STORE_CTX_cleanup(ctx);
  2168. >     OPENSSL_free(ctx);
  2169.   }
  2170.   

crypto/mem.c:286:1: start of procedure CRYPTO_free()
    284.   }
    285.   
    286. > void CRYPTO_free(void *str, const char *file, int line)
    287.   {
    288.       INCREMENT(free_count);

crypto/mem.c:289:9: Taking true branch
    287.   {
    288.       INCREMENT(free_count);
    289.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    290.           free_impl(str, file, line);
    291.           return;

crypto/mem.c:289:30: Taking true branch
    287.   {
    288.       INCREMENT(free_count);
    289.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    290.           free_impl(str, file, line);
    291.           return;

crypto/mem.c:290:9: Skipping __function_pointer__(): unresolved function pointer
    288.       INCREMENT(free_count);
    289.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    290.           free_impl(str, file, line);
                   ^
    291.           return;
    292.       }

crypto/mem.c:291:9: 
    289.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    290.           free_impl(str, file, line);
    291. >         return;
    292.       }
    293.   

crypto/mem.c:305:1: return from a call to CRYPTO_free
    303.       free(str);
    304.   #endif
    305. > }
    306.   
    307.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/x509/x509_vfy.c:2169:1: return from a call to X509_STORE_CTX_free
  2167.       X509_STORE_CTX_cleanup(ctx);
  2168.       OPENSSL_free(ctx);
  2169. > }
  2170.   
  2171.   int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509,
