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


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

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

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

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

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

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

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

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

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

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

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

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

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

ssl/statem/statem_lib.c:907:9: 
905.   
906.       if (chain_store != NULL) {
907. >         X509_STORE_CTX *xs_ctx = X509_STORE_CTX_new();
908.   
909.           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:197:1: start of procedure CRYPTO_zalloc()
    195.   }
    196.   
    197. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    198.   {
    199.       void *ret = CRYPTO_malloc(num, file, line);

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

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

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

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

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

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

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

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

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

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

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

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

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

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

crypto/mem.c:205:1: return from a call to CRYPTO_zalloc
    203.           memset(ret, 0, num);
    204.       return ret;
    205. > }
    206.   
    207.   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:909:13: Taking false branch
907.           X509_STORE_CTX *xs_ctx = X509_STORE_CTX_new();
908.   
909.           if (xs_ctx == NULL) {
                   ^
910.               SSLerr(SSL_F_SSL_ADD_CERT_CHAIN, ERR_R_MALLOC_FAILURE);
911.               goto err;

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

ssl/statem/statem_lib.c:914:13: 
912.           }
913.           if (!X509_STORE_CTX_init(xs_ctx, chain_store, x, NULL)) {
914. >             X509_STORE_CTX_free(xs_ctx);
915.               SSLerr(SSL_F_SSL_ADD_CERT_CHAIN, ERR_R_X509_LIB);
916.               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:264:1: start of procedure CRYPTO_free()
    262.   }
    263.   
    264. > void CRYPTO_free(void *str, const char *file, int line)
    265.   {
    266.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

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

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

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

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

crypto/mem.c:282:1: return from a call to CRYPTO_free
    280.       free(str);
    281.   #endif
    282. > }
    283.   
    284.   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,
