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


apps/ts.c:869:1: start of procedure create_verify_ctx()
867.   }
868.   
869. > static TS_VERIFY_CTX *create_verify_ctx(char *data, char *digest,
870.                                           char *queryfile,
871.                                           char *CApath, char *CAfile,

apps/ts.c:875:5: 
873.                                           X509_VERIFY_PARAM *vpm)
874.   {
875. >     TS_VERIFY_CTX *ctx = NULL;
876.       BIO *input = NULL;
877.       TS_REQ *request = NULL;

apps/ts.c:876:5: 
874.   {
875.       TS_VERIFY_CTX *ctx = NULL;
876. >     BIO *input = NULL;
877.       TS_REQ *request = NULL;
878.       int ret = 0;

apps/ts.c:877:5: 
875.       TS_VERIFY_CTX *ctx = NULL;
876.       BIO *input = NULL;
877. >     TS_REQ *request = NULL;
878.       int ret = 0;
879.       int f = 0;

apps/ts.c:878:5: 
876.       BIO *input = NULL;
877.       TS_REQ *request = NULL;
878. >     int ret = 0;
879.       int f = 0;
880.   

apps/ts.c:879:5: 
877.       TS_REQ *request = NULL;
878.       int ret = 0;
879. >     int f = 0;
880.   
881.       if (data != NULL || digest != NULL) {

apps/ts.c:881:9: Taking false branch
879.       int f = 0;
880.   
881.       if (data != NULL || digest != NULL) {
               ^
882.           if ((ctx = TS_VERIFY_CTX_new()) == NULL)
883.               goto err;

apps/ts.c:881:25: Taking true branch
879.       int f = 0;
880.   
881.       if (data != NULL || digest != NULL) {
                               ^
882.           if ((ctx = TS_VERIFY_CTX_new()) == NULL)
883.               goto err;

apps/ts.c:882:13: 
880.   
881.       if (data != NULL || digest != NULL) {
882. >         if ((ctx = TS_VERIFY_CTX_new()) == NULL)
883.               goto err;
884.           f = TS_VFY_VERSION | TS_VFY_SIGNER;

crypto/ts/ts_verify_ctx.c:15:1: start of procedure TS_VERIFY_CTX_new()
  13.   #include "ts_lcl.h"
  14.   
  15. > TS_VERIFY_CTX *TS_VERIFY_CTX_new(void)
  16.   {
  17.       TS_VERIFY_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));

crypto/ts/ts_verify_ctx.c:17:5: 
  15.   TS_VERIFY_CTX *TS_VERIFY_CTX_new(void)
  16.   {
  17. >     TS_VERIFY_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
  18.   
  19.       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/ts/ts_verify_ctx.c:19:9: Taking false branch
  17.       TS_VERIFY_CTX *ctx = OPENSSL_zalloc(sizeof(*ctx));
  18.   
  19.       if (ctx == NULL)
                ^
  20.           TSerr(TS_F_TS_VERIFY_CTX_NEW, ERR_R_MALLOC_FAILURE);
  21.       return ctx;

crypto/ts/ts_verify_ctx.c:21:5: 
  19.       if (ctx == NULL)
  20.           TSerr(TS_F_TS_VERIFY_CTX_NEW, ERR_R_MALLOC_FAILURE);
  21. >     return ctx;
  22.   }
  23.   

crypto/ts/ts_verify_ctx.c:22:1: return from a call to TS_VERIFY_CTX_new
  20.           TSerr(TS_F_TS_VERIFY_CTX_NEW, ERR_R_MALLOC_FAILURE);
  21.       return ctx;
  22. > }
  23.   
  24.   void TS_VERIFY_CTX_init(TS_VERIFY_CTX *ctx)

apps/ts.c:882:13: Taking false branch
880.   
881.       if (data != NULL || digest != NULL) {
882.           if ((ctx = TS_VERIFY_CTX_new()) == NULL)
                   ^
883.               goto err;
884.           f = TS_VFY_VERSION | TS_VFY_SIGNER;

apps/ts.c:884:9: 
882.           if ((ctx = TS_VERIFY_CTX_new()) == NULL)
883.               goto err;
884. >         f = TS_VFY_VERSION | TS_VFY_SIGNER;
885.           if (data != NULL) {
886.               f |= TS_VFY_DATA;

apps/ts.c:885:13: Taking false branch
883.               goto err;
884.           f = TS_VFY_VERSION | TS_VFY_SIGNER;
885.           if (data != NULL) {
                   ^
886.               f |= TS_VFY_DATA;
887.               if (TS_VERIFY_CTX_set_data(ctx, BIO_new_file(data, "rb")) == NULL)

apps/ts.c:889:20: Taking true branch
887.               if (TS_VERIFY_CTX_set_data(ctx, BIO_new_file(data, "rb")) == NULL)
888.                   goto err;
889.           } else if (digest != NULL) {
                          ^
890.               long imprint_len;
891.               unsigned char *hexstr = OPENSSL_hexstr2buf(digest, &imprint_len);

apps/ts.c:891:13: Skipping OPENSSL_hexstr2buf(): empty list of specs
889.           } else if (digest != NULL) {
890.               long imprint_len;
891.               unsigned char *hexstr = OPENSSL_hexstr2buf(digest, &imprint_len);
                   ^
892.               f |= TS_VFY_IMPRINT;
893.               if (TS_VERIFY_CTX_set_imprint(ctx, hexstr, imprint_len) == NULL) {

apps/ts.c:892:13: 
890.               long imprint_len;
891.               unsigned char *hexstr = OPENSSL_hexstr2buf(digest, &imprint_len);
892. >             f |= TS_VFY_IMPRINT;
893.               if (TS_VERIFY_CTX_set_imprint(ctx, hexstr, imprint_len) == NULL) {
894.                   BIO_printf(bio_err, "invalid digest string\n");

apps/ts.c:893:17: 
891.               unsigned char *hexstr = OPENSSL_hexstr2buf(digest, &imprint_len);
892.               f |= TS_VFY_IMPRINT;
893. >             if (TS_VERIFY_CTX_set_imprint(ctx, hexstr, imprint_len) == NULL) {
894.                   BIO_printf(bio_err, "invalid digest string\n");
895.                   goto err;

crypto/ts/ts_verify_ctx.c:70:1: start of procedure TS_VERIFY_CTX_set_imprint()
  68.   }
  69.   
  70. > unsigned char *TS_VERIFY_CTX_set_imprint(TS_VERIFY_CTX *ctx,
  71.                                            unsigned char *hexstr, long len)
  72.   {

crypto/ts/ts_verify_ctx.c:73:5: 
  71.                                            unsigned char *hexstr, long len)
  72.   {
  73. >     ctx->imprint = hexstr;
  74.       ctx->imprint_len = len;
  75.       return ctx->imprint;

crypto/ts/ts_verify_ctx.c:74:5: 
  72.   {
  73.       ctx->imprint = hexstr;
  74. >     ctx->imprint_len = len;
  75.       return ctx->imprint;
  76.   }

crypto/ts/ts_verify_ctx.c:75:5: 
  73.       ctx->imprint = hexstr;
  74.       ctx->imprint_len = len;
  75. >     return ctx->imprint;
  76.   }
  77.   

crypto/ts/ts_verify_ctx.c:76:1: return from a call to TS_VERIFY_CTX_set_imprint
  74.       ctx->imprint_len = len;
  75.       return ctx->imprint;
  76. > }
  77.   
  78.   void TS_VERIFY_CTX_cleanup(TS_VERIFY_CTX *ctx)

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

apps/ts.c:910:5: 
908.   
909.       /* Add the signature verification flag and arguments. */
910. >     TS_VERIFY_CTX_add_flags(ctx, f | TS_VFY_SIGNATURE);
911.   
912.       /* Initialising the X509_STORE object. */

crypto/ts/ts_verify_ctx.c:39:1: start of procedure TS_VERIFY_CTX_add_flags()
  37.   }
  38.   
  39. > int TS_VERIFY_CTX_add_flags(TS_VERIFY_CTX *ctx, int f)
  40.   {
  41.       ctx->flags |= f;

crypto/ts/ts_verify_ctx.c:41:5: 
  39.   int TS_VERIFY_CTX_add_flags(TS_VERIFY_CTX *ctx, int f)
  40.   {
  41. >     ctx->flags |= f;
  42.       return ctx->flags;
  43.   }

crypto/ts/ts_verify_ctx.c:42:5: 
  40.   {
  41.       ctx->flags |= f;
  42. >     return ctx->flags;
  43.   }
  44.   

crypto/ts/ts_verify_ctx.c:43:1: return from a call to TS_VERIFY_CTX_add_flags
  41.       ctx->flags |= f;
  42.       return ctx->flags;
  43. > }
  44.   
  45.   int TS_VERIFY_CTX_set_flags(TS_VERIFY_CTX *ctx, int f)

apps/ts.c:913:9: 
911.   
912.       /* Initialising the X509_STORE object. */
913. >     if (TS_VERIFY_CTX_set_store(ctx, create_cert_store(CApath, CAfile, vpm))
914.               == NULL)
915.           goto err;

apps/ts.c:933:1: start of procedure create_cert_store()
  931.   }
  932.   
  933. > static X509_STORE *create_cert_store(char *CApath, char *CAfile, X509_VERIFY_PARAM *vpm)
  934.   {
  935.       X509_STORE *cert_ctx = NULL;

apps/ts.c:935:5: 
  933.   static X509_STORE *create_cert_store(char *CApath, char *CAfile, X509_VERIFY_PARAM *vpm)
  934.   {
  935. >     X509_STORE *cert_ctx = NULL;
  936.       X509_LOOKUP *lookup = NULL;
  937.       int i;

apps/ts.c:936:5: 
  934.   {
  935.       X509_STORE *cert_ctx = NULL;
  936. >     X509_LOOKUP *lookup = NULL;
  937.       int i;
  938.   

apps/ts.c:939:5: Skipping X509_STORE_new(): empty list of specs
  937.       int i;
  938.   
  939.       cert_ctx = X509_STORE_new();
             ^
  940.       X509_STORE_set_verify_cb(cert_ctx, verify_cb);
  941.       if (CApath != NULL) {

apps/ts.c:940:5: 
  938.   
  939.       cert_ctx = X509_STORE_new();
  940. >     X509_STORE_set_verify_cb(cert_ctx, verify_cb);
  941.       if (CApath != NULL) {
  942.           lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_hash_dir());

crypto/x509/x509_lu.c:707:1: start of procedure X509_STORE_set_verify_cb()
    705.   }
    706.   
    707. > void X509_STORE_set_verify_cb(X509_STORE *ctx,
    708.                                 int (*verify_cb) (int, X509_STORE_CTX *))
    709.   {

crypto/x509/x509_lu.c:710:5: 
    708.                                 int (*verify_cb) (int, X509_STORE_CTX *))
    709.   {
    710. >     ctx->verify_cb = verify_cb;
    711.   }
    712.   

crypto/x509/x509_lu.c:711:1: return from a call to X509_STORE_set_verify_cb
    709.   {
    710.       ctx->verify_cb = verify_cb;
    711. > }
    712.   
    713.   void X509_STORE_set_verify(X509_STORE *ctx, X509_STORE_CTX_verify verify)

apps/ts.c:941:9: Taking true branch
  939.       cert_ctx = X509_STORE_new();
  940.       X509_STORE_set_verify_cb(cert_ctx, verify_cb);
  941.       if (CApath != NULL) {
                 ^
  942.           lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_hash_dir());
  943.           if (lookup == NULL) {

apps/ts.c:942:9: 
  940.       X509_STORE_set_verify_cb(cert_ctx, verify_cb);
  941.       if (CApath != NULL) {
  942. >         lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_hash_dir());
  943.           if (lookup == NULL) {
  944.               BIO_printf(bio_err, "memory allocation failure\n");

crypto/x509/by_dir.c:66:1: start of procedure X509_LOOKUP_hash_dir()
    64.   };
    65.   
    66. > X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void)
    67.   {
    68.       return (&x509_dir_lookup);

crypto/x509/by_dir.c:68:5: 
    66.   X509_LOOKUP_METHOD *X509_LOOKUP_hash_dir(void)
    67.   {
    68. >     return (&x509_dir_lookup);
    69.   }
    70.   

crypto/x509/by_dir.c:69:1: return from a call to X509_LOOKUP_hash_dir
    67.   {
    68.       return (&x509_dir_lookup);
    69. > }
    70.   
    71.   static int dir_ctrl(X509_LOOKUP *ctx, int cmd, const char *argp, long argl,

crypto/x509/x509_lu.c:221:1: start of procedure X509_STORE_add_lookup()
    219.   }
    220.   
    221. > X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m)
    222.   {
    223.       int i;

crypto/x509/x509_lu.c:227:5: 
    225.       X509_LOOKUP *lu;
    226.   
    227. >     sk = v->get_cert_methods;
    228.       for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) {
    229.           lu = sk_X509_LOOKUP_value(sk, i);

crypto/x509/x509_lu.c:228:10: 
    226.   
    227.       sk = v->get_cert_methods;
    228. >     for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) {
    229.           lu = sk_X509_LOOKUP_value(sk, i);
    230.           if (m == lu->method) {

crypto/x509/x509_lu.c:228:17: 
    226.   
    227.       sk = v->get_cert_methods;
    228. >     for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) {
    229.           lu = sk_X509_LOOKUP_value(sk, i);
    230.           if (m == lu->method) {

include/openssl/x509_vfy.h:53:1: start of procedure sk_X509_LOOKUP_num()
      51.   
      52.   
      53. > DEFINE_STACK_OF(X509_LOOKUP)
      54.   DEFINE_STACK_OF(X509_OBJECT)
      55.   DEFINE_STACK_OF(X509_VERIFY_PARAM)

crypto/stack/stack.c:270:1: start of procedure OPENSSL_sk_num()
        268.   }
        269.   
        270. > int OPENSSL_sk_num(const OPENSSL_STACK *st)
        271.   {
        272.       if (st == NULL)

crypto/stack/stack.c:272:9: Taking true branch
        270.   int OPENSSL_sk_num(const OPENSSL_STACK *st)
        271.   {
        272.       if (st == NULL)
                       ^
        273.           return -1;
        274.       return st->num;

crypto/stack/stack.c:273:9: 
        271.   {
        272.       if (st == NULL)
        273. >         return -1;
        274.       return st->num;
        275.   }

crypto/stack/stack.c:275:1: return from a call to OPENSSL_sk_num
        273.           return -1;
        274.       return st->num;
        275. > }
        276.   
        277.   void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)

include/openssl/x509_vfy.h:53:1: return from a call to sk_X509_LOOKUP_num
      51.   
      52.   
      53. > DEFINE_STACK_OF(X509_LOOKUP)
      54.   DEFINE_STACK_OF(X509_OBJECT)
      55.   DEFINE_STACK_OF(X509_VERIFY_PARAM)

crypto/x509/x509_lu.c:228:17: Loop condition is false. Leaving loop
    226.   
    227.       sk = v->get_cert_methods;
    228.       for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) {
                           ^
    229.           lu = sk_X509_LOOKUP_value(sk, i);
    230.           if (m == lu->method) {

crypto/x509/x509_lu.c:235:5: Skipping X509_LOOKUP_new(): empty list of specs
    233.       }
    234.       /* a new one */
    235.       lu = X509_LOOKUP_new(m);
               ^
    236.       if (lu == NULL)
    237.           return NULL;

crypto/x509/x509_lu.c:236:9: Taking true branch
    234.       /* a new one */
    235.       lu = X509_LOOKUP_new(m);
    236.       if (lu == NULL)
                   ^
    237.           return NULL;
    238.       else {

crypto/x509/x509_lu.c:237:9: 
    235.       lu = X509_LOOKUP_new(m);
    236.       if (lu == NULL)
    237. >         return NULL;
    238.       else {
    239.           lu->store_ctx = v;

crypto/x509/x509_lu.c:247:1: return from a call to X509_STORE_add_lookup
    245.           }
    246.       }
    247. > }
    248.   
    249.   X509_OBJECT *X509_STORE_CTX_get_obj_by_subject(X509_STORE_CTX *vs, int type,

apps/ts.c:943:13: Taking true branch
  941.       if (CApath != NULL) {
  942.           lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_hash_dir());
  943.           if (lookup == NULL) {
                     ^
  944.               BIO_printf(bio_err, "memory allocation failure\n");
  945.               goto err;

apps/ts.c:944:13: 
  942.           lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_hash_dir());
  943.           if (lookup == NULL) {
  944. >             BIO_printf(bio_err, "memory allocation failure\n");
  945.               goto err;
  946.           }

crypto/bio/b_print.c:707:1: start of procedure BIO_printf()
    705.   /***************************************************************************/
    706.   
    707. > int BIO_printf(BIO *bio, const char *format, ...)
    708.   {
    709.       va_list args;

crypto/bio/b_print.c:712:5: 
    710.       int ret;
    711.   
    712. >     va_start(args, format);
    713.   
    714.       ret = BIO_vprintf(bio, format, args);

crypto/bio/b_print.c:714:5: Skipping BIO_vprintf(): empty list of specs
    712.       va_start(args, format);
    713.   
    714.       ret = BIO_vprintf(bio, format, args);
               ^
    715.   
    716.       va_end(args);

crypto/bio/b_print.c:716:5: 
    714.       ret = BIO_vprintf(bio, format, args);
    715.   
    716. >     va_end(args);
    717.       return (ret);
    718.   }

crypto/bio/b_print.c:717:5: 
    715.   
    716.       va_end(args);
    717. >     return (ret);
    718.   }
    719.   

crypto/bio/b_print.c:718:1: return from a call to BIO_printf
    716.       va_end(args);
    717.       return (ret);
    718. > }
    719.   
    720.   int BIO_vprintf(BIO *bio, const char *format, va_list args)

apps/ts.c:972:2: 
  970.       return cert_ctx;
  971.   
  972. >  err:
  973.       X509_STORE_free(cert_ctx);
  974.       return NULL;

apps/ts.c:973:5: 
  971.   
  972.    err:
  973. >     X509_STORE_free(cert_ctx);
  974.       return NULL;
  975.   }

crypto/x509/x509_lu.c:179:1: start of procedure X509_STORE_free()
    177.   }
    178.   
    179. > void X509_STORE_free(X509_STORE *vfy)
    180.   {
    181.       int i;

crypto/x509/x509_lu.c:185:9: Taking false branch
    183.       X509_LOOKUP *lu;
    184.   
    185.       if (vfy == NULL)
                   ^
    186.           return;
    187.   

crypto/x509/x509_lu.c:188:5: 
    186.           return;
    187.   
    188. >     CRYPTO_atomic_add(&vfy->references, -1, &i, vfy->lock);
    189.       REF_PRINT_COUNT("X509_STORE", vfy);
    190.       if (i > 0)

crypto/threads_pthread.c:110:1: start of procedure CRYPTO_atomic_add()
      108.   }
      109.   
      110. > int CRYPTO_atomic_add(int *val, int amount, int *ret, CRYPTO_RWLOCK *lock)
      111.   {
      112.   #ifdef __ATOMIC_RELAXED

crypto/threads_pthread.c:113:5: 
      111.   {
      112.   #ifdef __ATOMIC_RELAXED
      113. >     *ret = __atomic_add_fetch(val, amount, __ATOMIC_RELAXED);
      114.   #else
      115.       if (!CRYPTO_THREAD_write_lock(lock))

crypto/threads_pthread.c:125:5: 
      123.   #endif
      124.   
      125. >     return 1;
      126.   }
      127.   

crypto/threads_pthread.c:126:1: return from a call to CRYPTO_atomic_add
      124.   
      125.       return 1;
      126. > }
      127.   
      128.   #endif

crypto/x509/x509_lu.c:190:9: Taking true branch
    188.       CRYPTO_atomic_add(&vfy->references, -1, &i, vfy->lock);
    189.       REF_PRINT_COUNT("X509_STORE", vfy);
    190.       if (i > 0)
                   ^
    191.           return;
    192.       REF_ASSERT_ISNT(i < 0);

crypto/x509/x509_lu.c:191:9: 
    189.       REF_PRINT_COUNT("X509_STORE", vfy);
    190.       if (i > 0)
    191. >         return;
    192.       REF_ASSERT_ISNT(i < 0);
    193.   

crypto/x509/x509_lu.c:207:1: return from a call to X509_STORE_free
    205.       CRYPTO_THREAD_lock_free(vfy->lock);
    206.       OPENSSL_free(vfy);
    207. > }
    208.   
    209.   int X509_STORE_up_ref(X509_STORE *vfy)

apps/ts.c:974:5: 
  972.    err:
  973.       X509_STORE_free(cert_ctx);
  974. >     return NULL;
  975.   }
  976.   

apps/ts.c:975:1: return from a call to create_cert_store
  973.       X509_STORE_free(cert_ctx);
  974.       return NULL;
  975. > }
  976.   
  977.   static int verify_cb(int ok, X509_STORE_CTX *ctx)

crypto/ts/ts_verify_ctx.c:57:1: start of procedure TS_VERIFY_CTX_set_store()
  55.   }
  56.   
  57. > X509_STORE *TS_VERIFY_CTX_set_store(TS_VERIFY_CTX *ctx, X509_STORE *s)
  58.   {
  59.       ctx->store = s;

crypto/ts/ts_verify_ctx.c:59:5: 
  57.   X509_STORE *TS_VERIFY_CTX_set_store(TS_VERIFY_CTX *ctx, X509_STORE *s)
  58.   {
  59. >     ctx->store = s;
  60.       return ctx->store;
  61.   }

crypto/ts/ts_verify_ctx.c:60:5: 
  58.   {
  59.       ctx->store = s;
  60. >     return ctx->store;
  61.   }
  62.   

crypto/ts/ts_verify_ctx.c:61:1: return from a call to TS_VERIFY_CTX_set_store
  59.       ctx->store = s;
  60.       return ctx->store;
  61. > }
  62.   
  63.   STACK_OF(X509) *TS_VERIFY_CTS_set_certs(TS_VERIFY_CTX *ctx,

apps/ts.c:913:9: Taking true branch
911.   
912.       /* Initialising the X509_STORE object. */
913.       if (TS_VERIFY_CTX_set_store(ctx, create_cert_store(CApath, CAfile, vpm))
               ^
914.               == NULL)
915.           goto err;

apps/ts.c:923:2: 
921.       ret = 1;
922.   
923. >  err:
924.       if (!ret) {
925.           TS_VERIFY_CTX_free(ctx);

apps/ts.c:924:10: Taking true branch
922.   
923.    err:
924.       if (!ret) {
                ^
925.           TS_VERIFY_CTX_free(ctx);
926.           ctx = NULL;

apps/ts.c:925:9: 
923.    err:
924.       if (!ret) {
925. >         TS_VERIFY_CTX_free(ctx);
926.           ctx = NULL;
927.       }

crypto/ts/ts_verify_ctx.c:30:1: start of procedure TS_VERIFY_CTX_free()
  28.   }
  29.   
  30. > void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx)
  31.   {
  32.       if (!ctx)

crypto/ts/ts_verify_ctx.c:32:10: Taking false branch
  30.   void TS_VERIFY_CTX_free(TS_VERIFY_CTX *ctx)
  31.   {
  32.       if (!ctx)
                 ^
  33.           return;
  34.   

crypto/ts/ts_verify_ctx.c:35:5: Skipping TS_VERIFY_CTX_cleanup(): empty list of specs
  33.           return;
  34.   
  35.       TS_VERIFY_CTX_cleanup(ctx);
            ^
  36.       OPENSSL_free(ctx);
  37.   }

crypto/ts/ts_verify_ctx.c:36:5: 
  34.   
  35.       TS_VERIFY_CTX_cleanup(ctx);
  36. >     OPENSSL_free(ctx);
  37.   }
  38.   

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/ts/ts_verify_ctx.c:37:1: return from a call to TS_VERIFY_CTX_free
  35.       TS_VERIFY_CTX_cleanup(ctx);
  36.       OPENSSL_free(ctx);
  37. > }
  38.   
  39.   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_hash_dir(void)\n{\n    return (&x509_dir_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 OPENSSL_sk_num(const OPENSSL_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}']