crypto/ts/ts_verify_ctx.c:193: error: MEMORY_LEAK
  memory dynamically allocated by call to `TS_VERIFY_CTX_new()` at line 161, column 21 is not reachable after line 193, column 9.
Showing all 55 steps of the trace


crypto/ts/ts_verify_ctx.c:149:1: start of procedure TS_REQ_to_TS_VERIFY_CTX()
147.   }
148.   
149. > TS_VERIFY_CTX *TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx)
150.   {
151.       TS_VERIFY_CTX *ret = ctx;

crypto/ts/ts_verify_ctx.c:151:5: 
149.   TS_VERIFY_CTX *TS_REQ_to_TS_VERIFY_CTX(TS_REQ *req, TS_VERIFY_CTX *ctx)
150.   {
151. >     TS_VERIFY_CTX *ret = ctx;
152.       ASN1_OBJECT *policy;
153.       TS_MSG_IMPRINT *imprint;

crypto/ts/ts_verify_ctx.c:158:5: Condition is true
156.       const ASN1_INTEGER *nonce;
157.   
158.       OPENSSL_assert(req != NULL);
           ^
159.       if (ret)
160.           TS_VERIFY_CTX_cleanup(ret);

crypto/ts/ts_verify_ctx.c:159:9: Taking false branch
157.   
158.       OPENSSL_assert(req != NULL);
159.       if (ret)
               ^
160.           TS_VERIFY_CTX_cleanup(ret);
161.       else if ((ret = TS_VERIFY_CTX_new()) == NULL)

crypto/ts/ts_verify_ctx.c:161:14: 
159.       if (ret)
160.           TS_VERIFY_CTX_cleanup(ret);
161. >     else if ((ret = TS_VERIFY_CTX_new()) == NULL)
162.           return NULL;
163.   

crypto/ts/ts_verify_ctx.c:64:1: start of procedure TS_VERIFY_CTX_new()
  62.   #include "ts_lcl.h"
  63.   
  64. > TS_VERIFY_CTX *TS_VERIFY_CTX_new(void)
  65.   {
  66.       TS_VERIFY_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));

crypto/ts/ts_verify_ctx.c:66:5: 
  64.   TS_VERIFY_CTX *TS_VERIFY_CTX_new(void)
  65.   {
  66. >     TS_VERIFY_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
  67.   
  68.       if (ctx == NULL)

crypto/mem.c:159:1: start of procedure CRYPTO_zalloc()
    157.   }
    158.   
    159. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    160.   {
    161.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:161:5: 
    159.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    160.   {
    161. >     void *ret = CRYPTO_malloc(num, file, line);
    162.   
    163.       if (ret != NULL)

crypto/mem.c:119:1: start of procedure CRYPTO_malloc()
      117.   }
      118.   
      119. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121.       void *ret = NULL;

crypto/mem.c:121:5: 
      119.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121. >     void *ret = NULL;
      122.   
      123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:123:9: Taking false branch
      121.       void *ret = NULL;
      122.   
      123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      124.           return malloc_impl(num, file, line);
      125.   

crypto/mem.c:126:9: Taking false branch
      124.           return malloc_impl(num, file, line);
      125.   
      126.       if (num <= 0)
                     ^
      127.           return NULL;
      128.   

crypto/mem.c:129:5: 
      127.           return NULL;
      128.   
      129. >     allow_customize = 0;
      130.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      131.       if (call_malloc_debug) {

crypto/mem.c:139:5: 
      137.       }
      138.   #else
      139. >     (void)file;
      140.       (void)line;
      141.       ret = malloc(num);

crypto/mem.c:140:5: 
      138.   #else
      139.       (void)file;
      140. >     (void)line;
      141.       ret = malloc(num);
      142.   #endif

crypto/mem.c:141:5: 
      139.       (void)file;
      140.       (void)line;
      141. >     ret = malloc(num);
      142.   #endif
      143.   

crypto/mem.c:156:5: 
      154.   #endif
      155.   
      156. >     return ret;
      157.   }
      158.   

crypto/mem.c:157:1: return from a call to CRYPTO_malloc
      155.   
      156.       return ret;
      157. > }
      158.   
      159.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:163:9: Taking true branch
    161.       void *ret = CRYPTO_malloc(num, file, line);
    162.   
    163.       if (ret != NULL)
                   ^
    164.           memset(ret, 0, num);
    165.       return ret;

crypto/mem.c:164:9: 
    162.   
    163.       if (ret != NULL)
    164. >         memset(ret, 0, num);
    165.       return ret;
    166.   }

crypto/mem.c:165:5: 
    163.       if (ret != NULL)
    164.           memset(ret, 0, num);
    165. >     return ret;
    166.   }
    167.   

crypto/mem.c:166:1: return from a call to CRYPTO_zalloc
    164.           memset(ret, 0, num);
    165.       return ret;
    166. > }
    167.   
    168.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/ts/ts_verify_ctx.c:68:9: Taking false branch
  66.       TS_VERIFY_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
  67.   
  68.       if (ctx == NULL)
                ^
  69.           TSerr(TS_F_TS_VERIFY_CTX_NEW, ERR_R_MALLOC_FAILURE);
  70.       return ctx;

crypto/ts/ts_verify_ctx.c:70:5: 
  68.       if (ctx == NULL)
  69.           TSerr(TS_F_TS_VERIFY_CTX_NEW, ERR_R_MALLOC_FAILURE);
  70. >     return ctx;
  71.   }
  72.   

crypto/ts/ts_verify_ctx.c:71:1: return from a call to TS_VERIFY_CTX_new
  69.           TSerr(TS_F_TS_VERIFY_CTX_NEW, ERR_R_MALLOC_FAILURE);
  70.       return ctx;
  71. > }
  72.   
  73.   void TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx)

crypto/ts/ts_verify_ctx.c:161:14: Taking false branch
159.       if (ret)
160.           TS_VERIFY_CTX_cleanup(ret);
161.       else if ((ret = TS_VERIFY_CTX_new()) == NULL)
                    ^
162.           return NULL;
163.   

crypto/ts/ts_verify_ctx.c:164:5: 
162.           return NULL;
163.   
164. >     ret->flags = TS_VFY_ALL_IMPRINT & ~(TS_VFY_TSA_NAME | TS_VFY_SIGNATURE);
165.   
166.       if ((policy = req->policy_id) != NULL) {

crypto/ts/ts_verify_ctx.c:166:9: Taking false branch
164.       ret->flags = TS_VFY_ALL_IMPRINT & ~(TS_VFY_TSA_NAME | TS_VFY_SIGNATURE);
165.   
166.       if ((policy = req->policy_id) != NULL) {
               ^
167.           if ((ret->policy = OBJ_dup(policy)) == NULL)
168.               goto err;

crypto/ts/ts_verify_ctx.c:170:9: 
168.               goto err;
169.       } else
170. >         ret->flags &= ~TS_VFY_POLICY;
171.   
172.       imprint = req->msg_imprint;

crypto/ts/ts_verify_ctx.c:172:5: 
170.           ret->flags &= ~TS_VFY_POLICY;
171.   
172. >     imprint = req->msg_imprint;
173.       md_alg = imprint->hash_algo;
174.       if ((ret->md_alg = X509_ALGOR_dup(md_alg)) == NULL)

crypto/ts/ts_verify_ctx.c:173:5: 
171.   
172.       imprint = req->msg_imprint;
173. >     md_alg = imprint->hash_algo;
174.       if ((ret->md_alg = X509_ALGOR_dup(md_alg)) == NULL)
175.           goto err;

crypto/ts/ts_verify_ctx.c:174:9: 
172.       imprint = req->msg_imprint;
173.       md_alg = imprint->hash_algo;
174. >     if ((ret->md_alg = X509_ALGOR_dup(md_alg)) == NULL)
175.           goto err;
176.       msg = imprint->hashed_msg;

crypto/asn1/x_algor.c:76:1: start of procedure X509_ALGOR_dup()
  74.   IMPLEMENT_ASN1_FUNCTIONS(X509_ALGOR)
  75.   IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(X509_ALGORS, X509_ALGORS, X509_ALGORS)
  76. > IMPLEMENT_ASN1_DUP_FUNCTION(X509_ALGOR)
  77.   
  78.   int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval)

crypto/asn1/a_dup.c:97:1: start of procedure ASN1_item_dup()
    95.    */
    96.   
    97. > void *ASN1_item_dup(const ASN1_ITEM *it, void *x)
    98.   {
    99.       unsigned char *b = NULL;

crypto/asn1/a_dup.c:99:5: 
    97.   void *ASN1_item_dup(const ASN1_ITEM *it, void *x)
    98.   {
    99. >     unsigned char *b = NULL;
    100.       const unsigned char *p;
    101.       long i;

crypto/asn1/a_dup.c:104:9: Taking true branch
    102.       void *ret;
    103.   
    104.       if (x == NULL)
                   ^
    105.           return (NULL);
    106.   

crypto/asn1/a_dup.c:105:9: 
    103.   
    104.       if (x == NULL)
    105. >         return (NULL);
    106.   
    107.       i = ASN1_item_i2d(x, &b, it);

crypto/asn1/a_dup.c:116:1: return from a call to ASN1_item_dup
    114.       OPENSSL_free(b);
    115.       return (ret);
    116. > }

crypto/asn1/x_algor.c:76:1: return from a call to X509_ALGOR_dup
  74.   IMPLEMENT_ASN1_FUNCTIONS(X509_ALGOR)
  75.   IMPLEMENT_ASN1_ENCODE_FUNCTIONS_fname(X509_ALGORS, X509_ALGORS, X509_ALGORS)
  76. > IMPLEMENT_ASN1_DUP_FUNCTION(X509_ALGOR)
  77.   
  78.   int X509_ALGOR_set0(X509_ALGOR *alg, ASN1_OBJECT *aobj, int ptype, void *pval)

crypto/ts/ts_verify_ctx.c:174:9: Taking true branch
172.       imprint = req->msg_imprint;
173.       md_alg = imprint->hash_algo;
174.       if ((ret->md_alg = X509_ALGOR_dup(md_alg)) == NULL)
               ^
175.           goto err;
176.       msg = imprint->hashed_msg;

crypto/ts/ts_verify_ctx.c:189:2: 
187.   
188.       return ret;
189. >  err:
190.       if (ctx)
191.           TS_VERIFY_CTX_cleanup(ctx);

crypto/ts/ts_verify_ctx.c:190:9: Taking false branch
188.       return ret;
189.    err:
190.       if (ctx)
               ^
191.           TS_VERIFY_CTX_cleanup(ctx);
192.       else

crypto/ts/ts_verify_ctx.c:193:9: 
191.           TS_VERIFY_CTX_cleanup(ctx);
192.       else
193. >         TS_VERIFY_CTX_free(ret);
194.       return NULL;
195.   }

crypto/ts/ts_verify_ctx.c:79:1: start of procedure TS_VERIFY_CTX_free()
  77.   }
  78.   
  79. > void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx)
  80.   {
  81.       if (!ctx)

crypto/ts/ts_verify_ctx.c:81:10: Taking false branch
  79.   void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx)
  80.   {
  81.       if (!ctx)
                 ^
  82.           return;
  83.   

crypto/ts/ts_verify_ctx.c:84:5: Skipping TS_VERIFY_CTX_cleanup(): empty list of specs
  82.           return;
  83.   
  84.       TS_VERIFY_CTX_cleanup(ctx);
            ^
  85.       OPENSSL_free(ctx);
  86.   }

crypto/ts/ts_verify_ctx.c:85:5: 
  83.   
  84.       TS_VERIFY_CTX_cleanup(ctx);
  85. >     OPENSSL_free(ctx);
  86.   }
  87.   

crypto/mem.c:225:1: start of procedure CRYPTO_free()
    223.   }
    224.   
    225. > void CRYPTO_free(void *str, const char *file, int line)
    226.   {
    227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:227:9: Taking true branch
    225.   void CRYPTO_free(void *str, const char *file, int line)
    226.   {
    227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    228.           free_impl(str, file, line);
    229.           return;

crypto/mem.c:227:30: Taking true branch
    225.   void CRYPTO_free(void *str, const char *file, int line)
    226.   {
    227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    228.           free_impl(str, file, line);
    229.           return;

crypto/mem.c:228:9: Skipping __function_pointer__(): unresolved function pointer
    226.   {
    227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    228.           free_impl(str, file, line);
                   ^
    229.           return;
    230.       }

crypto/mem.c:229:9: 
    227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    228.           free_impl(str, file, line);
    229. >         return;
    230.       }
    231.   

crypto/mem.c:243:1: return from a call to CRYPTO_free
    241.       free(str);
    242.   #endif
    243. > }
    244.   
    245.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/ts/ts_verify_ctx.c:86:1: return from a call to TS_VERIFY_CTX_free
  84.       TS_VERIFY_CTX_cleanup(ctx);
  85.       OPENSSL_free(ctx);
  86. > }
  87.   
  88.   int TS_VERIFY_CTX_add_flags(TS_VERIFY_CTX *ctx, int f)
