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:2150:1: start of procedure X509_STORE_CTX_new()
  2148.   }
  2149.   
  2150. > X509_STORE_CTX *X509_STORE_CTX_new(void)
  2151.   {
  2152.       X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));

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

crypto/mem.c:198:1: start of procedure CRYPTO_zalloc()
    196.   }
    197.   
    198. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    199.   {
    200.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:200:5: 
    198.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    199.   {
    200. >     void *ret = CRYPTO_malloc(num, file, line);
    201.   
    202.       FAILTEST();

crypto/mem.c:170:1: start of procedure CRYPTO_malloc()
      168.   #endif
      169.   
      170. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      171.   {
      172.       void *ret = NULL;

crypto/mem.c:172:5: 
      170.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      171.   {
      172. >     void *ret = NULL;
      173.   
      174.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:174:9: Taking false branch
      172.       void *ret = NULL;
      173.   
      174.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      175.           return malloc_impl(num, file, line);
      176.   

crypto/mem.c:177:9: Taking false branch
      175.           return malloc_impl(num, file, line);
      176.   
      177.       if (num == 0)
                     ^
      178.           return NULL;
      179.   

crypto/mem.c:181:5: 
      179.   
      180.       FAILTEST();
      181. >     allow_customize = 0;
      182.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      183.       if (call_malloc_debug) {

crypto/mem.c:191:5: 
      189.       }
      190.   #else
      191. >     (void)(file); (void)(line);
      192.       ret = malloc(num);
      193.   #endif

crypto/mem.c:191:19: 
      189.       }
      190.   #else
      191. >     (void)(file); (void)(line);
      192.       ret = malloc(num);
      193.   #endif

crypto/mem.c:192:5: 
      190.   #else
      191.       (void)(file); (void)(line);
      192. >     ret = malloc(num);
      193.   #endif
      194.   

crypto/mem.c:195:5: 
      193.   #endif
      194.   
      195. >     return ret;
      196.   }
      197.   

crypto/mem.c:196:1: return from a call to CRYPTO_malloc
      194.   
      195.       return ret;
      196. > }
      197.   
      198.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:203:9: Taking true branch
    201.   
    202.       FAILTEST();
    203.       if (ret != NULL)
                   ^
    204.           memset(ret, 0, num);
    205.       return ret;

crypto/mem.c:204:9: 
    202.       FAILTEST();
    203.       if (ret != NULL)
    204. >         memset(ret, 0, num);
    205.       return ret;
    206.   }

crypto/mem.c:205:5: 
    203.       if (ret != NULL)
    204.           memset(ret, 0, num);
    205. >     return ret;
    206.   }
    207.   

crypto/mem.c:206:1: return from a call to CRYPTO_zalloc
    204.           memset(ret, 0, num);
    205.       return ret;
    206. > }
    207.   
    208.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

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

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

crypto/x509/x509_vfy.c:2159:1: return from a call to X509_STORE_CTX_new
  2157.       }
  2158.       return ctx;
  2159. > }
  2160.   
  2161.   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:2161:1: start of procedure X509_STORE_CTX_free()
  2159.   }
  2160.   
  2161. > void X509_STORE_CTX_free(X509_STORE_CTX *ctx)
  2162.   {
  2163.       if (ctx == NULL)

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

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

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

crypto/mem.c:265:1: start of procedure CRYPTO_free()
    263.   }
    264.   
    265. > void CRYPTO_free(void *str, const char *file, int line)
    266.   {
    267.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:267:9: Taking true branch
    265.   void CRYPTO_free(void *str, const char *file, int line)
    266.   {
    267.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    268.           free_impl(str, file, line);
    269.           return;

crypto/mem.c:267:30: Taking true branch
    265.   void CRYPTO_free(void *str, const char *file, int line)
    266.   {
    267.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    268.           free_impl(str, file, line);
    269.           return;

crypto/mem.c:268:9: Skipping __function_pointer__(): unresolved function pointer
    266.   {
    267.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    268.           free_impl(str, file, line);
                   ^
    269.           return;
    270.       }

crypto/mem.c:269:9: 
    267.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    268.           free_impl(str, file, line);
    269. >         return;
    270.       }
    271.   

crypto/mem.c:283:1: return from a call to CRYPTO_free
    281.       free(str);
    282.   #endif
    283. > }
    284.   
    285.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

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