ssl/ssl_cert.c:800: error: MEMORY_LEAK
  memory dynamically allocated by call to `X509_STORE_CTX_new()` at line 793, column 34 is not reachable after line 800, column 13.
Showing all 48 steps of the trace


ssl/ssl_cert.c:764:1: start of procedure ssl_add_cert_chain()
762.   
763.   /* Add certificate chain to internal SSL BUF_MEM structure */
764. > int ssl_add_cert_chain(SSL *s, WPACKET *pkt, CERT_PKEY *cpk)
765.   {
766.       int i, chain_count;

ssl/ssl_cert.c:769:5: 
767.       X509 *x;
768.       STACK_OF(X509) *extra_certs;
769. >     STACK_OF(X509) *chain = NULL;
770.       X509_STORE *chain_store;
771.   

ssl/ssl_cert.c:772:9: Taking false branch
770.       X509_STORE *chain_store;
771.   
772.       if (cpk == NULL || cpk->x509 == NULL)
               ^
773.           return 1;
774.   

ssl/ssl_cert.c:772:24: Taking false branch
770.       X509_STORE *chain_store;
771.   
772.       if (cpk == NULL || cpk->x509 == NULL)
                              ^
773.           return 1;
774.   

ssl/ssl_cert.c:775:5: 
773.           return 1;
774.   
775. >     x = cpk->x509;
776.   
777.       /*

ssl/ssl_cert.c:780:9: Taking false branch
778.        * If we have a certificate specific chain use it, else use parent ctx.
779.        */
780.       if (cpk->chain)
               ^
781.           extra_certs = cpk->chain;
782.       else

ssl/ssl_cert.c:783:9: 
781.           extra_certs = cpk->chain;
782.       else
783. >         extra_certs = s->ctx->extra_certs;
784.   
785.       if ((s->mode & SSL_MODE_NO_AUTO_CHAIN) || extra_certs)

ssl/ssl_cert.c:785:10: Taking false branch
783.           extra_certs = s->ctx->extra_certs;
784.   
785.       if ((s->mode & SSL_MODE_NO_AUTO_CHAIN) || extra_certs)
                ^
786.           chain_store = NULL;
787.       else if (s->cert->chain_store)

ssl/ssl_cert.c:785:47: Taking false branch
783.           extra_certs = s->ctx->extra_certs;
784.   
785.       if ((s->mode & SSL_MODE_NO_AUTO_CHAIN) || extra_certs)
                                                     ^
786.           chain_store = NULL;
787.       else if (s->cert->chain_store)

ssl/ssl_cert.c:787:14: Taking false branch
785.       if ((s->mode & SSL_MODE_NO_AUTO_CHAIN) || extra_certs)
786.           chain_store = NULL;
787.       else if (s->cert->chain_store)
                    ^
788.           chain_store = s->cert->chain_store;
789.       else

ssl/ssl_cert.c:790:9: 
788.           chain_store = s->cert->chain_store;
789.       else
790. >         chain_store = s->ctx->cert_store;
791.   
792.       if (chain_store) {

ssl/ssl_cert.c:792:9: Taking true branch
790.           chain_store = s->ctx->cert_store;
791.   
792.       if (chain_store) {
               ^
793.           X509_STORE_CTX *xs_ctx = X509_STORE_CTX_new();
794.   

ssl/ssl_cert.c:793:9: 
791.   
792.       if (chain_store) {
793. >         X509_STORE_CTX *xs_ctx = X509_STORE_CTX_new();
794.   
795.           if (xs_ctx == NULL) {

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)

ssl/ssl_cert.c:795:13: Taking false branch
793.           X509_STORE_CTX *xs_ctx = X509_STORE_CTX_new();
794.   
795.           if (xs_ctx == NULL) {
                   ^
796.               SSLerr(SSL_F_SSL_ADD_CERT_CHAIN, ERR_R_MALLOC_FAILURE);
797.               return (0);

ssl/ssl_cert.c:799:14: Taking true branch
797.               return (0);
798.           }
799.           if (!X509_STORE_CTX_init(xs_ctx, chain_store, x, NULL)) {
                    ^
800.               X509_STORE_CTX_free(xs_ctx);
801.               SSLerr(SSL_F_SSL_ADD_CERT_CHAIN, ERR_R_X509_LIB);

ssl/ssl_cert.c:800:13: 
798.           }
799.           if (!X509_STORE_CTX_init(xs_ctx, chain_store, x, NULL)) {
800. >             X509_STORE_CTX_free(xs_ctx);
801.               SSLerr(SSL_F_SSL_ADD_CERT_CHAIN, ERR_R_X509_LIB);
802.               return (0);

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,
