apps/ts.c:974: error: MEMORY_LEAK
  memory dynamically allocated by call to `TS_VERIFY_CTX_new()` at line 931, column 20 is not reachable after line 974, column 9.
Showing all 119 steps of the trace


apps/ts.c:918:1: start of procedure create_verify_ctx()
916.   }
917.   
918. > static TS_VERIFY_CTX *create_verify_ctx(char *data, char *digest,
919.                                           char *queryfile,
920.                                           char *CApath, char *CAfile,

apps/ts.c:924:5: 
922.                                           X509_VERIFY_PARAM *vpm)
923.   {
924. >     TS_VERIFY_CTX *ctx = NULL;
925.       BIO *input = NULL;
926.       TS_REQ *request = NULL;

apps/ts.c:925:5: 
923.   {
924.       TS_VERIFY_CTX *ctx = NULL;
925. >     BIO *input = NULL;
926.       TS_REQ *request = NULL;
927.       int ret = 0;

apps/ts.c:926:5: 
924.       TS_VERIFY_CTX *ctx = NULL;
925.       BIO *input = NULL;
926. >     TS_REQ *request = NULL;
927.       int ret = 0;
928.       int f = 0;

apps/ts.c:927:5: 
925.       BIO *input = NULL;
926.       TS_REQ *request = NULL;
927. >     int ret = 0;
928.       int f = 0;
929.   

apps/ts.c:928:5: 
926.       TS_REQ *request = NULL;
927.       int ret = 0;
928. >     int f = 0;
929.   
930.       if (data != NULL || digest != NULL) {

apps/ts.c:930:9: Taking false branch
928.       int f = 0;
929.   
930.       if (data != NULL || digest != NULL) {
               ^
931.           if ((ctx = TS_VERIFY_CTX_new()) == NULL)
932.               goto err;

apps/ts.c:930:25: Taking true branch
928.       int f = 0;
929.   
930.       if (data != NULL || digest != NULL) {
                               ^
931.           if ((ctx = TS_VERIFY_CTX_new()) == NULL)
932.               goto err;

apps/ts.c:931:13: 
929.   
930.       if (data != NULL || digest != NULL) {
931. >         if ((ctx = TS_VERIFY_CTX_new()) == NULL)
932.               goto err;
933.           f = TS_VFY_VERSION | TS_VFY_SIGNER;

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:146:1: start of procedure CRYPTO_zalloc()
    144.   }
    145.   
    146. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    147.   {
    148.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:148:5: 
    146.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    147.   {
    148. >     void *ret = CRYPTO_malloc(num, file, line);
    149.   
    150.       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. >     osslargused(file); osslargused(line);
      140.       ret = malloc(num);
      141.   #endif

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

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

crypto/mem.c:143:5: 
      141.   #endif
      142.   
      143. >     return ret;
      144.   }
      145.   

crypto/mem.c:144:1: return from a call to CRYPTO_malloc
      142.   
      143.       return ret;
      144. > }
      145.   
      146.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:150:9: Taking true branch
    148.       void *ret = CRYPTO_malloc(num, file, line);
    149.   
    150.       if (ret != NULL)
                   ^
    151.           memset(ret, 0, num);
    152.       return ret;

crypto/mem.c:151:9: 
    149.   
    150.       if (ret != NULL)
    151. >         memset(ret, 0, num);
    152.       return ret;
    153.   }

crypto/mem.c:152:5: 
    150.       if (ret != NULL)
    151.           memset(ret, 0, num);
    152. >     return ret;
    153.   }
    154.   

crypto/mem.c:153:1: return from a call to CRYPTO_zalloc
    151.           memset(ret, 0, num);
    152.       return ret;
    153. > }
    154.   
    155.   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)

apps/ts.c:931:13: Taking false branch
929.   
930.       if (data != NULL || digest != NULL) {
931.           if ((ctx = TS_VERIFY_CTX_new()) == NULL)
                   ^
932.               goto err;
933.           f = TS_VFY_VERSION | TS_VFY_SIGNER;

apps/ts.c:933:9: 
931.           if ((ctx = TS_VERIFY_CTX_new()) == NULL)
932.               goto err;
933. >         f = TS_VFY_VERSION | TS_VFY_SIGNER;
934.           if (data != NULL) {
935.               f |= TS_VFY_DATA;

apps/ts.c:934:13: Taking false branch
932.               goto err;
933.           f = TS_VFY_VERSION | TS_VFY_SIGNER;
934.           if (data != NULL) {
                   ^
935.               f |= TS_VFY_DATA;
936.               if (TS_VERIFY_CTX_set_data(ctx, BIO_new_file(data, "rb")) == NULL)

apps/ts.c:938:20: Taking true branch
936.               if (TS_VERIFY_CTX_set_data(ctx, BIO_new_file(data, "rb")) == NULL)
937.                   goto err;
938.           } else if (digest != NULL) {
                          ^
939.               long imprint_len;
940.               unsigned char *hexstr = OPENSSL_hexstr2buf(digest, &imprint_len);

apps/ts.c:940:13: Skipping OPENSSL_hexstr2buf(): empty list of specs
938.           } else if (digest != NULL) {
939.               long imprint_len;
940.               unsigned char *hexstr = OPENSSL_hexstr2buf(digest, &imprint_len);
                   ^
941.               f |= TS_VFY_IMPRINT;
942.               if (TS_VERIFY_CTX_set_imprint(ctx, hexstr, imprint_len) == NULL) {

apps/ts.c:941:13: 
939.               long imprint_len;
940.               unsigned char *hexstr = OPENSSL_hexstr2buf(digest, &imprint_len);
941. >             f |= TS_VFY_IMPRINT;
942.               if (TS_VERIFY_CTX_set_imprint(ctx, hexstr, imprint_len) == NULL) {
943.                   BIO_printf(bio_err, "invalid digest string\n");

apps/ts.c:942:17: 
940.               unsigned char *hexstr = OPENSSL_hexstr2buf(digest, &imprint_len);
941.               f |= TS_VFY_IMPRINT;
942. >             if (TS_VERIFY_CTX_set_imprint(ctx, hexstr, imprint_len) == NULL) {
943.                   BIO_printf(bio_err, "invalid digest string\n");
944.                   goto err;

crypto/ts/ts_verify_ctx.c:119:1: start of procedure TS_VERIFY_CTX_set_imprint()
  117.   }
  118.   
  119. > unsigned char *TS_VERIFY_CTX_set_imprint(TS_VERIFY_CTX *ctx,
  120.                                            unsigned char *hexstr, long len)
  121.   {

crypto/ts/ts_verify_ctx.c:122:5: 
  120.                                            unsigned char *hexstr, long len)
  121.   {
  122. >     ctx->imprint = hexstr;
  123.       ctx->imprint_len = len;
  124.       return ctx->imprint;

crypto/ts/ts_verify_ctx.c:123:5: 
  121.   {
  122.       ctx->imprint = hexstr;
  123. >     ctx->imprint_len = len;
  124.       return ctx->imprint;
  125.   }

crypto/ts/ts_verify_ctx.c:124:5: 
  122.       ctx->imprint = hexstr;
  123.       ctx->imprint_len = len;
  124. >     return ctx->imprint;
  125.   }
  126.   

crypto/ts/ts_verify_ctx.c:125:1: return from a call to TS_VERIFY_CTX_set_imprint
  123.       ctx->imprint_len = len;
  124.       return ctx->imprint;
  125. > }
  126.   
  127.   void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx)

apps/ts.c:942:17: Taking false branch
940.               unsigned char *hexstr = OPENSSL_hexstr2buf(digest, &imprint_len);
941.               f |= TS_VFY_IMPRINT;
942.               if (TS_VERIFY_CTX_set_imprint(ctx, hexstr, imprint_len) == NULL) {
                       ^
943.                   BIO_printf(bio_err, "invalid digest string\n");
944.                   goto err;

apps/ts.c:959:5: 
957.   
958.       /* Add the signature verification flag and arguments. */
959. >     TS_VERIFY_CTX_add_flags(ctx, f | TS_VFY_SIGNATURE);
960.   
961.       /* Initialising the X509_STORE object. */

crypto/ts/ts_verify_ctx.c:88:1: start of procedure TS_VERIFY_CTX_add_flags()
  86.   }
  87.   
  88. > int TS_VERIFY_CTX_add_flags(TS_VERIFY_CTX *ctx, int f)
  89.   {
  90.       ctx->flags |= f;

crypto/ts/ts_verify_ctx.c:90:5: 
  88.   int TS_VERIFY_CTX_add_flags(TS_VERIFY_CTX *ctx, int f)
  89.   {
  90. >     ctx->flags |= f;
  91.       return ctx->flags;
  92.   }

crypto/ts/ts_verify_ctx.c:91:5: 
  89.   {
  90.       ctx->flags |= f;
  91. >     return ctx->flags;
  92.   }
  93.   

crypto/ts/ts_verify_ctx.c:92:1: return from a call to TS_VERIFY_CTX_add_flags
  90.       ctx->flags |= f;
  91.       return ctx->flags;
  92. > }
  93.   
  94.   int TS_VERIFY_CTX_set_flags(TS_VERIFY_CTX *ctx, int f)

apps/ts.c:962:9: 
960.   
961.       /* Initialising the X509_STORE object. */
962. >     if (TS_VERIFY_CTX_set_store(ctx, create_cert_store(CApath, CAfile, vpm))
963.               == NULL)
964.           goto err;

apps/ts.c:982:1: start of procedure create_cert_store()
  980.   }
  981.   
  982. > static X509_STORE *create_cert_store(char *CApath, char *CAfile, X509_VERIFY_PARAM *vpm)
  983.   {
  984.       X509_STORE *cert_ctx = NULL;

apps/ts.c:984:5: 
  982.   static X509_STORE *create_cert_store(char *CApath, char *CAfile, X509_VERIFY_PARAM *vpm)
  983.   {
  984. >     X509_STORE *cert_ctx = NULL;
  985.       X509_LOOKUP *lookup = NULL;
  986.       int i;

apps/ts.c:985:5: 
  983.   {
  984.       X509_STORE *cert_ctx = NULL;
  985. >     X509_LOOKUP *lookup = NULL;
  986.       int i;
  987.   

apps/ts.c:988:5: Skipping X509_STORE_new(): empty list of specs
  986.       int i;
  987.   
  988.       cert_ctx = X509_STORE_new();
             ^
  989.       X509_STORE_set_verify_cb(cert_ctx, verify_cb);
  990.       if (CApath != NULL) {

apps/ts.c:989:5: 
  987.   
  988.       cert_ctx = X509_STORE_new();
  989. >     X509_STORE_set_verify_cb(cert_ctx, verify_cb);
  990.       if (CApath != NULL) {
  991.           lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_hash_dir());

crypto/x509/x509_lu.c:732:1: start of procedure X509_STORE_set_verify_cb()
    730.   }
    731.   
    732. > void X509_STORE_set_verify_cb(X509_STORE *ctx,
    733.                                 int (*verify_cb) (int, X509_STORE_CTX *))
    734.   {

crypto/x509/x509_lu.c:735:5: 
    733.                                 int (*verify_cb) (int, X509_STORE_CTX *))
    734.   {
    735. >     ctx->verify_cb = verify_cb;
    736.   }
    737.   

crypto/x509/x509_lu.c:736:1: return from a call to X509_STORE_set_verify_cb
    734.   {
    735.       ctx->verify_cb = verify_cb;
    736. > }
    737.   
    738.   void X509_STORE_set_lookup_crls_cb(X509_STORE *ctx,

apps/ts.c:990:9: Taking false branch
  988.       cert_ctx = X509_STORE_new();
  989.       X509_STORE_set_verify_cb(cert_ctx, verify_cb);
  990.       if (CApath != NULL) {
                 ^
  991.           lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_hash_dir());
  992.           if (lookup == NULL) {

apps/ts.c:1003:9: Taking true branch
  1001.       }
  1002.   
  1003.       if (CAfile != NULL) {
                  ^
  1004.           lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_file());
  1005.           if (lookup == NULL) {

apps/ts.c:1004:9: 
  1002.   
  1003.       if (CAfile != NULL) {
  1004. >         lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_file());
  1005.           if (lookup == NULL) {
  1006.               BIO_printf(bio_err, "memory allocation failure\n");

crypto/x509/by_file.c:84:1: start of procedure X509_LOOKUP_file()
    82.   };
    83.   
    84. > X509_LOOKUP_METHOD *X509_LOOKUP_file(void)
    85.   {
    86.       return (&x509_file_lookup);

crypto/x509/by_file.c:86:5: 
    84.   X509_LOOKUP_METHOD *X509_LOOKUP_file(void)
    85.   {
    86. >     return (&x509_file_lookup);
    87.   }
    88.   

crypto/x509/by_file.c:87:1: return from a call to X509_LOOKUP_file
    85.   {
    86.       return (&x509_file_lookup);
    87. > }
    88.   
    89.   static int by_file_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp,

crypto/x509/x509_lu.c:269:1: start of procedure X509_STORE_add_lookup()
    267.   }
    268.   
    269. > X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m)
    270.   {
    271.       int i;

crypto/x509/x509_lu.c:275:5: 
    273.       X509_LOOKUP *lu;
    274.   
    275. >     sk = v->get_cert_methods;
    276.       for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) {
    277.           lu = sk_X509_LOOKUP_value(sk, i);

crypto/x509/x509_lu.c:276:10: 
    274.   
    275.       sk = v->get_cert_methods;
    276. >     for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) {
    277.           lu = sk_X509_LOOKUP_value(sk, i);
    278.           if (m == lu->method) {

crypto/x509/x509_lu.c:276:17: 
    274.   
    275.       sk = v->get_cert_methods;
    276. >     for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) {
    277.           lu = sk_X509_LOOKUP_value(sk, i);
    278.           if (m == lu->method) {

include/openssl/x509_vfy.h:101:1: start of procedure sk_X509_LOOKUP_num()
      99.   
      100.   
      101. > DEFINE_STACK_OF(X509_LOOKUP)
      102.   DEFINE_STACK_OF(X509_OBJECT)
      103.   DEFINE_STACK_OF(X509_VERIFY_PARAM)

crypto/stack/stack.c:316:1: start of procedure sk_num()
        314.   }
        315.   
        316. > int sk_num(const _STACK *st)
        317.   {
        318.       if (st == NULL)

crypto/stack/stack.c:318:9: Taking true branch
        316.   int sk_num(const _STACK *st)
        317.   {
        318.       if (st == NULL)
                       ^
        319.           return -1;
        320.       return st->num;

crypto/stack/stack.c:319:9: 
        317.   {
        318.       if (st == NULL)
        319. >         return -1;
        320.       return st->num;
        321.   }

crypto/stack/stack.c:321:1: return from a call to sk_num
        319.           return -1;
        320.       return st->num;
        321. > }
        322.   
        323.   void *sk_value(const _STACK *st, int i)

include/openssl/x509_vfy.h:101:1: return from a call to sk_X509_LOOKUP_num
      99.   
      100.   
      101. > DEFINE_STACK_OF(X509_LOOKUP)
      102.   DEFINE_STACK_OF(X509_OBJECT)
      103.   DEFINE_STACK_OF(X509_VERIFY_PARAM)

crypto/x509/x509_lu.c:276:17: Loop condition is false. Leaving loop
    274.   
    275.       sk = v->get_cert_methods;
    276.       for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) {
                           ^
    277.           lu = sk_X509_LOOKUP_value(sk, i);
    278.           if (m == lu->method) {

crypto/x509/x509_lu.c:283:5: Skipping X509_LOOKUP_new(): empty list of specs
    281.       }
    282.       /* a new one */
    283.       lu = X509_LOOKUP_new(m);
               ^
    284.       if (lu == NULL)
    285.           return NULL;

crypto/x509/x509_lu.c:284:9: Taking true branch
    282.       /* a new one */
    283.       lu = X509_LOOKUP_new(m);
    284.       if (lu == NULL)
                   ^
    285.           return NULL;
    286.       else {

crypto/x509/x509_lu.c:285:9: 
    283.       lu = X509_LOOKUP_new(m);
    284.       if (lu == NULL)
    285. >         return NULL;
    286.       else {
    287.           lu->store_ctx = v;

crypto/x509/x509_lu.c:295:1: return from a call to X509_STORE_add_lookup
    293.           }
    294.       }
    295. > }
    296.   
    297.   X509_OBJECT *X509_STORE_get_X509_by_subject(X509_STORE_CTX *vs, int type,

apps/ts.c:1005:13: Taking true branch
  1003.       if (CAfile != NULL) {
  1004.           lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_file());
  1005.           if (lookup == NULL) {
                      ^
  1006.               BIO_printf(bio_err, "memory allocation failure\n");
  1007.               goto err;

apps/ts.c:1006:13: 
  1004.           lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_file());
  1005.           if (lookup == NULL) {
  1006. >             BIO_printf(bio_err, "memory allocation failure\n");
  1007.               goto err;
  1008.           }

crypto/bio/b_print.c:776:1: start of procedure BIO_printf()
    774.   /***************************************************************************/
    775.   
    776. > int BIO_printf(BIO *bio, const char *format, ...)
    777.   {
    778.       va_list args;

crypto/bio/b_print.c:781:5: 
    779.       int ret;
    780.   
    781. >     va_start(args, format);
    782.   
    783.       ret = BIO_vprintf(bio, format, args);

crypto/bio/b_print.c:783:5: Skipping BIO_vprintf(): empty list of specs
    781.       va_start(args, format);
    782.   
    783.       ret = BIO_vprintf(bio, format, args);
               ^
    784.   
    785.       va_end(args);

crypto/bio/b_print.c:785:5: 
    783.       ret = BIO_vprintf(bio, format, args);
    784.   
    785. >     va_end(args);
    786.       return (ret);
    787.   }

crypto/bio/b_print.c:786:5: 
    784.   
    785.       va_end(args);
    786. >     return (ret);
    787.   }
    788.   

crypto/bio/b_print.c:787:1: return from a call to BIO_printf
    785.       va_end(args);
    786.       return (ret);
    787. > }
    788.   
    789.   int BIO_vprintf(BIO *bio, const char *format, va_list args)

apps/ts.c:1021:2: 
  1019.       return cert_ctx;
  1020.   
  1021. >  err:
  1022.       X509_STORE_free(cert_ctx);
  1023.       return NULL;

apps/ts.c:1022:5: 
  1020.   
  1021.    err:
  1022. >     X509_STORE_free(cert_ctx);
  1023.       return NULL;
  1024.   }

crypto/x509/x509_lu.c:227:1: start of procedure X509_STORE_free()
    225.   }
    226.   
    227. > void X509_STORE_free(X509_STORE *vfy)
    228.   {
    229.       int i;

crypto/x509/x509_lu.c:233:9: Taking false branch
    231.       X509_LOOKUP *lu;
    232.   
    233.       if (vfy == NULL)
                   ^
    234.           return;
    235.   

crypto/x509/x509_lu.c:236:5: 
    234.           return;
    235.   
    236. >     CRYPTO_atomic_add(&vfy->references, -1, &i, vfy->lock);
    237.       REF_PRINT_COUNT("X509_STORE", vfy);
    238.       if (i > 0)

crypto/threads_pthread.c:151:1: start of procedure CRYPTO_atomic_add()
      149.   }
      150.   
      151. > int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock)
      152.   {
      153.   #ifdef __ATOMIC_RELAXED

crypto/threads_pthread.c:154:5: 
      152.   {
      153.   #ifdef __ATOMIC_RELAXED
      154. >     *ret = __atomic_add_fetch(val, amount, __ATOMIC_RELAXED);
      155.   #else
      156.       if (!CRYPTO_THREAD_write_lock(lock))

crypto/threads_pthread.c:166:5: 
      164.   #endif
      165.   
      166. >     return 1;
      167.   }
      168.   

crypto/threads_pthread.c:167:1: return from a call to CRYPTO_atomic_add
      165.   
      166.       return 1;
      167. > }
      168.   
      169.   #endif

crypto/x509/x509_lu.c:238:9: Taking true branch
    236.       CRYPTO_atomic_add(&vfy->references, -1, &i, vfy->lock);
    237.       REF_PRINT_COUNT("X509_STORE", vfy);
    238.       if (i > 0)
                   ^
    239.           return;
    240.       REF_ASSERT_ISNT(i < 0);

crypto/x509/x509_lu.c:239:9: 
    237.       REF_PRINT_COUNT("X509_STORE", vfy);
    238.       if (i > 0)
    239. >         return;
    240.       REF_ASSERT_ISNT(i < 0);
    241.   

crypto/x509/x509_lu.c:255:1: return from a call to X509_STORE_free
    253.       CRYPTO_THREAD_lock_free(vfy->lock);
    254.       OPENSSL_free(vfy);
    255. > }
    256.   
    257.   int X509_STORE_up_ref(X509_STORE *vfy)

apps/ts.c:1023:5: 
  1021.    err:
  1022.       X509_STORE_free(cert_ctx);
  1023. >     return NULL;
  1024.   }
  1025.   

apps/ts.c:1024:1: return from a call to create_cert_store
  1022.       X509_STORE_free(cert_ctx);
  1023.       return NULL;
  1024. > }
  1025.   
  1026.   static int verify_cb(int ok, X509_STORE_CTX *ctx)

crypto/ts/ts_verify_ctx.c:106:1: start of procedure TS_VERIFY_CTX_set_store()
  104.   }
  105.   
  106. > X509_STORE *TS_VERIFY_CTX_set_store(TS_VERIFY_CTX *ctx, X509_STORE *s)
  107.   {
  108.       ctx->store = s;

crypto/ts/ts_verify_ctx.c:108:5: 
  106.   X509_STORE *TS_VERIFY_CTX_set_store(TS_VERIFY_CTX *ctx, X509_STORE *s)
  107.   {
  108. >     ctx->store = s;
  109.       return ctx->store;
  110.   }

crypto/ts/ts_verify_ctx.c:109:5: 
  107.   {
  108.       ctx->store = s;
  109. >     return ctx->store;
  110.   }
  111.   

crypto/ts/ts_verify_ctx.c:110:1: return from a call to TS_VERIFY_CTX_set_store
  108.       ctx->store = s;
  109.       return ctx->store;
  110. > }
  111.   
  112.   STACK_OF(X509) *TS_VERIFY_CTS_set_certs(TS_VERIFY_CTX *ctx,

apps/ts.c:962:9: Taking true branch
960.   
961.       /* Initialising the X509_STORE object. */
962.       if (TS_VERIFY_CTX_set_store(ctx, create_cert_store(CApath, CAfile, vpm))
               ^
963.               == NULL)
964.           goto err;

apps/ts.c:972:2: 
970.       ret = 1;
971.   
972. >  err:
973.       if (!ret) {
974.           TS_VERIFY_CTX_free(ctx);

apps/ts.c:973:10: Taking true branch
971.   
972.    err:
973.       if (!ret) {
                ^
974.           TS_VERIFY_CTX_free(ctx);
975.           ctx = NULL;

apps/ts.c:974:9: 
972.    err:
973.       if (!ret) {
974. >         TS_VERIFY_CTX_free(ctx);
975.           ctx = NULL;
976.       }

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:211:1: start of procedure CRYPTO_free()
    209.   }
    210.   
    211. > void CRYPTO_free(void *str, const char *file, int line)
    212.   {
    213.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:213:9: Taking true branch
    211.   void CRYPTO_free(void *str, const char *file, int line)
    212.   {
    213.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    214.           free_impl(str, file, line);
    215.           return;

crypto/mem.c:213:30: Taking true branch
    211.   void CRYPTO_free(void *str, const char *file, int line)
    212.   {
    213.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    214.           free_impl(str, file, line);
    215.           return;

crypto/mem.c:214:9: Skipping __function_pointer__(): unresolved function pointer
    212.   {
    213.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    214.           free_impl(str, file, line);
                   ^
    215.           return;
    216.       }

crypto/mem.c:215:9: 
    213.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    214.           free_impl(str, file, line);
    215. >         return;
    216.       }
    217.   

crypto/mem.c:229:1: return from a call to CRYPTO_free
    227.       free(str);
    228.   #endif
    229. > }
    230.   
    231.   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)

static TS_VERIFY_CTX *create_verify_ctx(char *data, char *digest,
                                        char *queryfile,
                                        char *CApath, char *CAfile,
                                        char *untrusted,
                                        X509_VERIFY_PARAM *vpm)
{
    TS_VERIFY_CTX *ctx = NULL;
    BIO *input = NULL;
    TS_REQ *request = NULL;
    int ret = 0;
    int f = 0;
    if (data != NULL || digest != NULL) {
        if ((ctx = TS_VERIFY_CTX_new()) == NULL)
            goto err;
        f = TS_VFY_VERSION | TS_VFY_SIGNER;
        if (data != NULL) {
            f |= TS_VFY_DATA;
            if (TS_VERIFY_CTX_set_data(ctx, BIO_new_file(data, "rb")) == NULL)
                goto err;
        } else if (digest != NULL) {
            long imprint_len;
            unsigned char *hexstr = OPENSSL_hexstr2buf(digest, &imprint_len);
            f |= TS_VFY_IMPRINT;
            if (TS_VERIFY_CTX_set_imprint(ctx, hexstr, imprint_len) == NULL) {
                BIO_printf(bio_err, "invalid digest string\n");
                goto err;
            }
        }
    } else if (queryfile != NULL) {
        if ((input = BIO_new_file(queryfile, "rb")) == NULL)
            goto err;
        if ((request = d2i_TS_REQ_bio(input, NULL)) == NULL)
            goto err;
        if ((ctx = TS_REQ_to_TS_VERIFY_CTX(request, NULL)) == NULL)
            goto err;
    } else
        return NULL;
    TS_VERIFY_CTX_add_flags(ctx, f | TS_VFY_SIGNATURE);
    if (TS_VERIFY_CTX_set_store(ctx, create_cert_store(CApath, CAfile, vpm))
            == NULL)
        goto err;
    if (untrusted
        && TS_VERIFY_CTS_set_certs(ctx, TS_CONF_load_certs(untrusted)) == NULL)
        goto err;
    ret = 1;
 err:
    if (!ret) {
        TS_VERIFY_CTX_free(ctx);
        ctx = NULL;
    }
    BIO_free_all(input);
    TS_REQ_free(request);
    return ctx;
}
['static TS_VERIFY_CTX *create_verify_ctx(char *data, char *digest,\n                                        char *queryfile,\n                                        char *CApath, char *CAfile,\n                                        char *untrusted,\n                                        X509_VERIFY_PARAM *vpm)\n{\n    TS_VERIFY_CTX *ctx = NULL;\n    BIO *input = NULL;\n    TS_REQ *request = NULL;\n    int ret = 0;\n    int f = 0;\n    if (data != NULL || digest != NULL) {\n        if ((ctx = TS_VERIFY_CTX_new()) == NULL)\n            goto err;\n        f = TS_VFY_VERSION | TS_VFY_SIGNER;\n        if (data != NULL) {\n            f |= TS_VFY_DATA;\n            if (TS_VERIFY_CTX_set_data(ctx, BIO_new_file(data, "rb")) == NULL)\n                goto err;\n        } else if (digest != NULL) {\n            long imprint_len;\n            unsigned char *hexstr = OPENSSL_hexstr2buf(digest, &imprint_len);\n            f |= TS_VFY_IMPRINT;\n            if (TS_VERIFY_CTX_set_imprint(ctx, hexstr, imprint_len) == NULL) {\n                BIO_printf(bio_err, "invalid digest string\\n");\n                goto err;\n            }\n        }\n    } else if (queryfile != NULL) {\n        if ((input = BIO_new_file(queryfile, "rb")) == NULL)\n            goto err;\n        if ((request = d2i_TS_REQ_bio(input, NULL)) == NULL)\n            goto err;\n        if ((ctx = TS_REQ_to_TS_VERIFY_CTX(request, NULL)) == NULL)\n            goto err;\n    } else\n        return NULL;\n    TS_VERIFY_CTX_add_flags(ctx, f | TS_VFY_SIGNATURE);\n    if (TS_VERIFY_CTX_set_store(ctx, create_cert_store(CApath, CAfile, vpm))\n            == NULL)\n        goto err;\n    if (untrusted\n        && TS_VERIFY_CTS_set_certs(ctx, TS_CONF_load_certs(untrusted)) == NULL)\n        goto err;\n    ret = 1;\n err:\n    if (!ret) {\n        TS_VERIFY_CTX_free(ctx);\n        ctx = NULL;\n    }\n    BIO_free_all(input);\n    TS_REQ_free(request);\n    return ctx;\n}', 'TS_VERIFY_CTX *TS_VERIFY_CTX_new(void)\n{\n    TS_VERIFY_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));\n    if (ctx == NULL)\n        TSerr(TS_F_TS_VERIFY_CTX_NEW, ERR_R_MALLOC_FAILURE);\n    return ctx;\n}', 'void *CRYPTO_zalloc(size_t num, const char *file, int line)\n{\n    void *ret = CRYPTO_malloc(num, file, line);\n    if (ret != NULL)\n        memset(ret, 0, num);\n    return ret;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)\n        return malloc_impl(num, file, line);\n    if (num <= 0)\n        return NULL;\n    allow_customize = 0;\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);\n        ret = malloc(num);\n        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);\n    } else {\n        ret = malloc(num);\n    }\n#else\n    osslargused(file); osslargused(line);\n    ret = malloc(num);\n#endif\n    return ret;\n}', 'unsigned char *TS_VERIFY_CTX_set_imprint(TS_VERIFY_CTX *ctx,\n                                         unsigned char *hexstr, long len)\n{\n    ctx->imprint = hexstr;\n    ctx->imprint_len = len;\n    return ctx->imprint;\n}', 'int TS_VERIFY_CTX_add_flags(TS_VERIFY_CTX *ctx, int f)\n{\n    ctx->flags |= f;\n    return ctx->flags;\n}', 'static X509_STORE *create_cert_store(char *CApath, char *CAfile, X509_VERIFY_PARAM *vpm)\n{\n    X509_STORE *cert_ctx = NULL;\n    X509_LOOKUP *lookup = NULL;\n    int i;\n    cert_ctx = X509_STORE_new();\n    X509_STORE_set_verify_cb(cert_ctx, verify_cb);\n    if (CApath != NULL) {\n        lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_hash_dir());\n        if (lookup == NULL) {\n            BIO_printf(bio_err, "memory allocation failure\\n");\n            goto err;\n        }\n        i = X509_LOOKUP_add_dir(lookup, CApath, X509_FILETYPE_PEM);\n        if (!i) {\n            BIO_printf(bio_err, "Error loading directory %s\\n", CApath);\n            goto err;\n        }\n    }\n    if (CAfile != NULL) {\n        lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_file());\n        if (lookup == NULL) {\n            BIO_printf(bio_err, "memory allocation failure\\n");\n            goto err;\n        }\n        i = X509_LOOKUP_load_file(lookup, CAfile, X509_FILETYPE_PEM);\n        if (!i) {\n            BIO_printf(bio_err, "Error loading file %s\\n", CAfile);\n            goto err;\n        }\n    }\n    if (vpm != NULL)\n        X509_STORE_set1_param(cert_ctx, vpm);\n    return cert_ctx;\n err:\n    X509_STORE_free(cert_ctx);\n    return NULL;\n}', 'void X509_STORE_set_verify_cb(X509_STORE *ctx,\n                              int (*verify_cb) (int, X509_STORE_CTX *))\n{\n    ctx->verify_cb = verify_cb;\n}', 'X509_LOOKUP_METHOD *X509_LOOKUP_file(void)\n{\n    return (&x509_file_lookup);\n}', 'X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m)\n{\n    int i;\n    STACK_OF(X509_LOOKUP) *sk;\n    X509_LOOKUP *lu;\n    sk = v->get_cert_methods;\n    for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) {\n        lu = sk_X509_LOOKUP_value(sk, i);\n        if (m == lu->method) {\n            return lu;\n        }\n    }\n    lu = X509_LOOKUP_new(m);\n    if (lu == NULL)\n        return NULL;\n    else {\n        lu->store_ctx = v;\n        if (sk_X509_LOOKUP_push(v->get_cert_methods, lu))\n            return lu;\n        else {\n            X509_LOOKUP_free(lu);\n            return NULL;\n        }\n    }\n}', 'int sk_num(const _STACK *st)\n{\n    if (st == NULL)\n        return -1;\n    return st->num;\n}', 'int BIO_printf(BIO *bio, const char *format, ...)\n{\n    va_list args;\n    int ret;\n    va_start(args, format);\n    ret = BIO_vprintf(bio, format, args);\n    va_end(args);\n    return (ret);\n}', 'void X509_STORE_free(X509_STORE *vfy)\n{\n    int i;\n    STACK_OF(X509_LOOKUP) *sk;\n    X509_LOOKUP *lu;\n    if (vfy == NULL)\n        return;\n    CRYPTO_atomic_add(&vfy->references, -1, &i, vfy->lock);\n    REF_PRINT_COUNT("X509_STORE", vfy);\n    if (i > 0)\n        return;\n    REF_ASSERT_ISNT(i < 0);\n    sk = vfy->get_cert_methods;\n    for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) {\n        lu = sk_X509_LOOKUP_value(sk, i);\n        X509_LOOKUP_shutdown(lu);\n        X509_LOOKUP_free(lu);\n    }\n    sk_X509_LOOKUP_free(sk);\n    sk_X509_OBJECT_pop_free(vfy->objs, cleanup);\n    CRYPTO_free_ex_data(CRYPTO_EX_INDEX_X509_STORE, vfy, &vfy->ex_data);\n    X509_VERIFY_PARAM_free(vfy->param);\n    CRYPTO_THREAD_lock_free(vfy->lock);\n    OPENSSL_free(vfy);\n}', 'int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock)\n{\n#ifdef __ATOMIC_RELAXED\n    *ret = __atomic_add_fetch(val, amount, __ATOMIC_RELAXED);\n#else\n    if (!CRYPTO_THREAD_write_lock(lock))\n        return 0;\n    *val += amount;\n    *ret  = *val;\n    if (!CRYPTO_THREAD_unlock(lock))\n        return 0;\n#endif\n    return 1;\n}', 'X509_STORE *TS_VERIFY_CTX_set_store(TS_VERIFY_CTX *ctx, X509_STORE *s)\n{\n    ctx->store = s;\n    return ctx->store;\n}', 'void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx)\n{\n    if (!ctx)\n        return;\n    TS_VERIFY_CTX_cleanup(ctx);\n    OPENSSL_free(ctx);\n}', 'void CRYPTO_free(void *str, const char *file, int line)\n{\n    if (free_impl != NULL && free_impl != &CRYPTO_free) {\n        free_impl(str, file, line);\n        return;\n    }\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_free(str, 0, file, line);\n        free(str);\n        CRYPTO_mem_debug_free(str, 1, file, line);\n    } else {\n        free(str);\n    }\n#else\n    free(str);\n#endif\n}']