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


ssl/statem/statem_lib.c:905:1: start of procedure ssl_add_cert_chain()
903.   
904.   /* Add certificate chain to provided WPACKET */
905. > static int ssl_add_cert_chain(SSL *s, WPACKET *pkt, CERT_PKEY *cpk)
906.   {
907.       int i, chain_count;

ssl/statem/statem_lib.c:910:5: 
908.       X509 *x;
909.       STACK_OF(X509) *extra_certs;
910. >     STACK_OF(X509) *chain = NULL;
911.       X509_STORE *chain_store;
912.   

ssl/statem/statem_lib.c:913:9: Taking false branch
911.       X509_STORE *chain_store;
912.   
913.       if (cpk == NULL || cpk->x509 == NULL)
               ^
914.           return 1;
915.   

ssl/statem/statem_lib.c:913:24: Taking false branch
911.       X509_STORE *chain_store;
912.   
913.       if (cpk == NULL || cpk->x509 == NULL)
                              ^
914.           return 1;
915.   

ssl/statem/statem_lib.c:916:5: 
914.           return 1;
915.   
916. >     x = cpk->x509;
917.   
918.       /*

ssl/statem/statem_lib.c:921:9: Taking false branch
919.        * If we have a certificate specific chain use it, else use parent ctx.
920.        */
921.       if (cpk->chain != NULL)
               ^
922.           extra_certs = cpk->chain;
923.       else

ssl/statem/statem_lib.c:924:9: 
922.           extra_certs = cpk->chain;
923.       else
924. >         extra_certs = s->ctx->extra_certs;
925.   
926.       if ((s->mode & SSL_MODE_NO_AUTO_CHAIN) || extra_certs)

ssl/statem/statem_lib.c:926:10: Taking false branch
924.           extra_certs = s->ctx->extra_certs;
925.   
926.       if ((s->mode & SSL_MODE_NO_AUTO_CHAIN) || extra_certs)
                ^
927.           chain_store = NULL;
928.       else if (s->cert->chain_store)

ssl/statem/statem_lib.c:926:47: Taking false branch
924.           extra_certs = s->ctx->extra_certs;
925.   
926.       if ((s->mode & SSL_MODE_NO_AUTO_CHAIN) || extra_certs)
                                                     ^
927.           chain_store = NULL;
928.       else if (s->cert->chain_store)

ssl/statem/statem_lib.c:928:14: Taking false branch
926.       if ((s->mode & SSL_MODE_NO_AUTO_CHAIN) || extra_certs)
927.           chain_store = NULL;
928.       else if (s->cert->chain_store)
                    ^
929.           chain_store = s->cert->chain_store;
930.       else

ssl/statem/statem_lib.c:931:9: 
929.           chain_store = s->cert->chain_store;
930.       else
931. >         chain_store = s->ctx->cert_store;
932.   
933.       if (chain_store != NULL) {

ssl/statem/statem_lib.c:933:9: Taking true branch
931.           chain_store = s->ctx->cert_store;
932.   
933.       if (chain_store != NULL) {
               ^
934.           X509_STORE_CTX *xs_ctx = X509_STORE_CTX_new();
935.   

ssl/statem/statem_lib.c:934:9: 
932.   
933.       if (chain_store != NULL) {
934. >         X509_STORE_CTX *xs_ctx = X509_STORE_CTX_new();
935.   
936.           if (xs_ctx == NULL) {

crypto/x509/x509_vfy.c:2179:1: start of procedure X509_STORE_CTX_new()
  2177.   }
  2178.   
  2179. > X509_STORE_CTX *X509_STORE_CTX_new(void)
  2180.   {
  2181.       X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));

crypto/x509/x509_vfy.c:2181:5: 
  2179.   X509_STORE_CTX *X509_STORE_CTX_new(void)
  2180.   {
  2181. >     X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
  2182.   
  2183.       if (ctx == NULL) {

crypto/mem.c:228:1: start of procedure CRYPTO_zalloc()
    226.   }
    227.   
    228. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    229.   {
    230.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:230:5: 
    228.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    229.   {
    230. >     void *ret = CRYPTO_malloc(num, file, line);
    231.   
    232.       FAILTEST();

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

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

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

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

crypto/mem.c:204:9: Taking false branch
      202.   
      203.       FAILTEST();
      204.       if (allow_customize) {
                     ^
      205.           /*
      206.            * Disallow customization after the first allocation. We only set this

crypto/mem.c:221:5: 
      219.       }
      220.   #else
      221. >     (void)(file); (void)(line);
      222.       ret = malloc(num);
      223.   #endif

crypto/mem.c:221:19: 
      219.       }
      220.   #else
      221. >     (void)(file); (void)(line);
      222.       ret = malloc(num);
      223.   #endif

crypto/mem.c:222:5: 
      220.   #else
      221.       (void)(file); (void)(line);
      222. >     ret = malloc(num);
      223.   #endif
      224.   

crypto/mem.c:225:5: 
      223.   #endif
      224.   
      225. >     return ret;
      226.   }
      227.   

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

crypto/mem.c:233:9: Taking true branch
    231.   
    232.       FAILTEST();
    233.       if (ret != NULL)
                   ^
    234.           memset(ret, 0, num);
    235.       return ret;

crypto/mem.c:234:9: 
    232.       FAILTEST();
    233.       if (ret != NULL)
    234. >         memset(ret, 0, num);
    235.       return ret;
    236.   }

crypto/mem.c:235:5: 
    233.       if (ret != NULL)
    234.           memset(ret, 0, num);
    235. >     return ret;
    236.   }
    237.   

crypto/mem.c:236:1: return from a call to CRYPTO_zalloc
    234.           memset(ret, 0, num);
    235.       return ret;
    236. > }
    237.   
    238.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/x509/x509_vfy.c:2183:9: Taking false branch
  2181.       X509_STORE_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
  2182.   
  2183.       if (ctx == NULL) {
                  ^
  2184.           X509err(X509_F_X509_STORE_CTX_NEW, ERR_R_MALLOC_FAILURE);
  2185.           return NULL;

crypto/x509/x509_vfy.c:2187:5: 
  2185.           return NULL;
  2186.       }
  2187. >     return ctx;
  2188.   }
  2189.   

crypto/x509/x509_vfy.c:2188:1: return from a call to X509_STORE_CTX_new
  2186.       }
  2187.       return ctx;
  2188. > }
  2189.   
  2190.   void X509_STORE_CTX_free(X509_STORE_CTX *ctx)

ssl/statem/statem_lib.c:936:13: Taking false branch
934.           X509_STORE_CTX *xs_ctx = X509_STORE_CTX_new();
935.   
936.           if (xs_ctx == NULL) {
                   ^
937.               SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL_ADD_CERT_CHAIN,
938.                        ERR_R_MALLOC_FAILURE);

ssl/statem/statem_lib.c:941:14: Taking true branch
939.               return 0;
940.           }
941.           if (!X509_STORE_CTX_init(xs_ctx, chain_store, x, NULL)) {
                    ^
942.               X509_STORE_CTX_free(xs_ctx);
943.               SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL_ADD_CERT_CHAIN,

ssl/statem/statem_lib.c:942:13: 
940.           }
941.           if (!X509_STORE_CTX_init(xs_ctx, chain_store, x, NULL)) {
942. >             X509_STORE_CTX_free(xs_ctx);
943.               SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_SSL_ADD_CERT_CHAIN,
944.                        ERR_R_X509_LIB);

crypto/x509/x509_vfy.c:2190:1: start of procedure X509_STORE_CTX_free()
  2188.   }
  2189.   
  2190. > void X509_STORE_CTX_free(X509_STORE_CTX *ctx)
  2191.   {
  2192.       if (ctx == NULL)

crypto/x509/x509_vfy.c:2192:9: Taking false branch
  2190.   void X509_STORE_CTX_free(X509_STORE_CTX *ctx)
  2191.   {
  2192.       if (ctx == NULL)
                  ^
  2193.           return;
  2194.   

crypto/x509/x509_vfy.c:2195:5: Skipping X509_STORE_CTX_cleanup(): empty list of specs
  2193.           return;
  2194.   
  2195.       X509_STORE_CTX_cleanup(ctx);
              ^
  2196.       OPENSSL_free(ctx);
  2197.   }

crypto/x509/x509_vfy.c:2196:5: 
  2194.   
  2195.       X509_STORE_CTX_cleanup(ctx);
  2196. >     OPENSSL_free(ctx);
  2197.   }
  2198.   

crypto/mem.c:295:1: start of procedure CRYPTO_free()
    293.   }
    294.   
    295. > void CRYPTO_free(void *str, const char *file, int line)
    296.   {
    297.       INCREMENT(free_count);

crypto/mem.c:298:9: Taking true branch
    296.   {
    297.       INCREMENT(free_count);
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    299.           free_impl(str, file, line);
    300.           return;

crypto/mem.c:298:30: Taking true branch
    296.   {
    297.       INCREMENT(free_count);
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    299.           free_impl(str, file, line);
    300.           return;

crypto/mem.c:299:9: Skipping __function_pointer__(): unresolved function pointer
    297.       INCREMENT(free_count);
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    299.           free_impl(str, file, line);
                   ^
    300.           return;
    301.       }

crypto/mem.c:300:9: 
    298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    299.           free_impl(str, file, line);
    300. >         return;
    301.       }
    302.   

crypto/mem.c:314:1: return from a call to CRYPTO_free
    312.       free(str);
    313.   #endif
    314. > }
    315.   
    316.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/x509/x509_vfy.c:2197:1: return from a call to X509_STORE_CTX_free
  2195.       X509_STORE_CTX_cleanup(ctx);
  2196.       OPENSSL_free(ctx);
  2197. > }
  2198.   
  2199.   int X509_STORE_CTX_init(X509_STORE_CTX *ctx, X509_STORE *store, X509 *x509,
