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


apps/ts.c:873:1: start of procedure create_verify_ctx()
871.   }
872.   
873. > static TS_VERIFY_CTX *create_verify_ctx(const char *data, const char *digest,
874.                                           const char *queryfile,
875.                                           const char *CApath, const char *CAfile,

apps/ts.c:879:5: 
877.                                           X509_VERIFY_PARAM *vpm)
878.   {
879. >     TS_VERIFY_CTX *ctx = NULL;
880.       BIO *input = NULL;
881.       TS_REQ *request = NULL;

apps/ts.c:880:5: 
878.   {
879.       TS_VERIFY_CTX *ctx = NULL;
880. >     BIO *input = NULL;
881.       TS_REQ *request = NULL;
882.       int ret = 0;

apps/ts.c:881:5: 
879.       TS_VERIFY_CTX *ctx = NULL;
880.       BIO *input = NULL;
881. >     TS_REQ *request = NULL;
882.       int ret = 0;
883.       int f = 0;

apps/ts.c:882:5: 
880.       BIO *input = NULL;
881.       TS_REQ *request = NULL;
882. >     int ret = 0;
883.       int f = 0;
884.   

apps/ts.c:883:5: 
881.       TS_REQ *request = NULL;
882.       int ret = 0;
883. >     int f = 0;
884.   
885.       if (data != NULL || digest != NULL) {

apps/ts.c:885:9: Taking false branch
883.       int f = 0;
884.   
885.       if (data != NULL || digest != NULL) {
               ^
886.           if ((ctx = TS_VERIFY_CTX_new()) == NULL)
887.               goto err;

apps/ts.c:885:25: Taking true branch
883.       int f = 0;
884.   
885.       if (data != NULL || digest != NULL) {
                               ^
886.           if ((ctx = TS_VERIFY_CTX_new()) == NULL)
887.               goto err;

apps/ts.c:886:13: 
884.   
885.       if (data != NULL || digest != NULL) {
886. >         if ((ctx = TS_VERIFY_CTX_new()) == NULL)
887.               goto err;
888.           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:886:13: Taking false branch
884.   
885.       if (data != NULL || digest != NULL) {
886.           if ((ctx = TS_VERIFY_CTX_new()) == NULL)
                   ^
887.               goto err;
888.           f = TS_VFY_VERSION | TS_VFY_SIGNER;

apps/ts.c:888:9: 
886.           if ((ctx = TS_VERIFY_CTX_new()) == NULL)
887.               goto err;
888. >         f = TS_VFY_VERSION | TS_VFY_SIGNER;
889.           if (data != NULL) {
890.               f |= TS_VFY_DATA;

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

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

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

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

apps/ts.c:897:17: 
895.               unsigned char *hexstr = OPENSSL_hexstr2buf(digest, &imprint_len);
896.               f |= TS_VFY_IMPRINT;
897. >             if (TS_VERIFY_CTX_set_imprint(ctx, hexstr, imprint_len) == NULL) {
898.                   BIO_printf(bio_err, "invalid digest string\n");
899.                   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:897:17: Taking false branch
895.               unsigned char *hexstr = OPENSSL_hexstr2buf(digest, &imprint_len);
896.               f |= TS_VFY_IMPRINT;
897.               if (TS_VERIFY_CTX_set_imprint(ctx, hexstr, imprint_len) == NULL) {
                       ^
898.                   BIO_printf(bio_err, "invalid digest string\n");
899.                   goto err;

apps/ts.c:914:5: 
912.   
913.       /* Add the signature verification flag and arguments. */
914. >     TS_VERIFY_CTX_add_flags(ctx, f | TS_VFY_SIGNATURE);
915.   
916.       /* 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:917:9: 
915.   
916.       /* Initialising the X509_STORE object. */
917. >     if (TS_VERIFY_CTX_set_store(ctx, create_cert_store(CApath, CAfile, vpm))
918.               == NULL)
919.           goto err;

apps/ts.c:937:1: start of procedure create_cert_store()
  935.   }
  936.   
  937. > static X509_STORE *create_cert_store(const char *CApath, const char *CAfile,
  938.                                        X509_VERIFY_PARAM *vpm)
  939.   {

apps/ts.c:940:5: 
  938.                                        X509_VERIFY_PARAM *vpm)
  939.   {
  940. >     X509_STORE *cert_ctx = NULL;
  941.       X509_LOOKUP *lookup = NULL;
  942.       int i;

apps/ts.c:941:5: 
  939.   {
  940.       X509_STORE *cert_ctx = NULL;
  941. >     X509_LOOKUP *lookup = NULL;
  942.       int i;
  943.   

apps/ts.c:944:5: Skipping X509_STORE_new(): empty list of specs
  942.       int i;
  943.   
  944.       cert_ctx = X509_STORE_new();
             ^
  945.       X509_STORE_set_verify_cb(cert_ctx, verify_cb);
  946.       if (CApath != NULL) {

apps/ts.c:945:5: 
  943.   
  944.       cert_ctx = X509_STORE_new();
  945. >     X509_STORE_set_verify_cb(cert_ctx, verify_cb);
  946.       if (CApath != NULL) {
  947.           lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_hash_dir());

crypto/x509/x509_lu.c:727:1: start of procedure X509_STORE_set_verify_cb()
    725.   }
    726.   
    727. > void X509_STORE_set_verify_cb(X509_STORE *ctx,
    728.                                 X509_STORE_CTX_verify_cb verify_cb)
    729.   {

crypto/x509/x509_lu.c:730:5: 
    728.                                 X509_STORE_CTX_verify_cb verify_cb)
    729.   {
    730. >     ctx->verify_cb = verify_cb;
    731.   }
    732.   

crypto/x509/x509_lu.c:731:1: return from a call to X509_STORE_set_verify_cb
    729.   {
    730.       ctx->verify_cb = verify_cb;
    731. > }
    732.   
    733.   X509_STORE_CTX_verify_cb X509_STORE_get_verify_cb(X509_STORE *ctx)

apps/ts.c:946:9: Taking true branch
  944.       cert_ctx = X509_STORE_new();
  945.       X509_STORE_set_verify_cb(cert_ctx, verify_cb);
  946.       if (CApath != NULL) {
                 ^
  947.           lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_hash_dir());
  948.           if (lookup == NULL) {

apps/ts.c:947:9: 
  945.       X509_STORE_set_verify_cb(cert_ctx, verify_cb);
  946.       if (CApath != NULL) {
  947. >         lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_hash_dir());
  948.           if (lookup == NULL) {
  949.               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:232:1: start of procedure X509_STORE_add_lookup()
    230.   }
    231.   
    232. > X509_LOOKUP *X509_STORE_add_lookup(X509_STORE *v, X509_LOOKUP_METHOD *m)
    233.   {
    234.       int i;

crypto/x509/x509_lu.c:238:5: 
    236.       X509_LOOKUP *lu;
    237.   
    238. >     sk = v->get_cert_methods;
    239.       for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) {
    240.           lu = sk_X509_LOOKUP_value(sk, i);

crypto/x509/x509_lu.c:239:10: 
    237.   
    238.       sk = v->get_cert_methods;
    239. >     for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) {
    240.           lu = sk_X509_LOOKUP_value(sk, i);
    241.           if (m == lu->method) {

crypto/x509/x509_lu.c:239:17: 
    237.   
    238.       sk = v->get_cert_methods;
    239. >     for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) {
    240.           lu = sk_X509_LOOKUP_value(sk, i);
    241.           if (m == lu->method) {

include/openssl/x509_vfy.h:57:1: start of procedure sk_X509_LOOKUP_num()
      55.   #endif
      56.   
      57. > DEFINE_STACK_OF(X509_LOOKUP)
      58.   DEFINE_STACK_OF(X509_OBJECT)
      59.   DEFINE_STACK_OF(X509_VERIFY_PARAM)

crypto/stack/stack.c:277:1: start of procedure OPENSSL_sk_num()
        275.   }
        276.   
        277. > int OPENSSL_sk_num(const OPENSSL_STACK *st)
        278.   {
        279.       if (st == NULL)

crypto/stack/stack.c:279:9: Taking true branch
        277.   int OPENSSL_sk_num(const OPENSSL_STACK *st)
        278.   {
        279.       if (st == NULL)
                       ^
        280.           return -1;
        281.       return st->num;

crypto/stack/stack.c:280:9: 
        278.   {
        279.       if (st == NULL)
        280. >         return -1;
        281.       return st->num;
        282.   }

crypto/stack/stack.c:282:1: return from a call to OPENSSL_sk_num
        280.           return -1;
        281.       return st->num;
        282. > }
        283.   
        284.   void *OPENSSL_sk_value(const OPENSSL_STACK *st, int i)

include/openssl/x509_vfy.h:57:1: return from a call to sk_X509_LOOKUP_num
      55.   #endif
      56.   
      57. > DEFINE_STACK_OF(X509_LOOKUP)
      58.   DEFINE_STACK_OF(X509_OBJECT)
      59.   DEFINE_STACK_OF(X509_VERIFY_PARAM)

crypto/x509/x509_lu.c:239:17: Loop condition is false. Leaving loop
    237.   
    238.       sk = v->get_cert_methods;
    239.       for (i = 0; i < sk_X509_LOOKUP_num(sk); i++) {
                           ^
    240.           lu = sk_X509_LOOKUP_value(sk, i);
    241.           if (m == lu->method) {

crypto/x509/x509_lu.c:246:5: Skipping X509_LOOKUP_new(): empty list of specs
    244.       }
    245.       /* a new one */
    246.       lu = X509_LOOKUP_new(m);
               ^
    247.       if (lu == NULL)
    248.           return NULL;

crypto/x509/x509_lu.c:247:9: Taking true branch
    245.       /* a new one */
    246.       lu = X509_LOOKUP_new(m);
    247.       if (lu == NULL)
                   ^
    248.           return NULL;
    249.       else {

crypto/x509/x509_lu.c:248:9: 
    246.       lu = X509_LOOKUP_new(m);
    247.       if (lu == NULL)
    248. >         return NULL;
    249.       else {
    250.           lu->store_ctx = v;

crypto/x509/x509_lu.c:258:1: return from a call to X509_STORE_add_lookup
    256.           }
    257.       }
    258. > }
    259.   
    260.   X509_OBJECT *X509_STORE_CTX_get_obj_by_subject(X509_STORE_CTX *vs,

apps/ts.c:948:13: Taking true branch
  946.       if (CApath != NULL) {
  947.           lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_hash_dir());
  948.           if (lookup == NULL) {
                     ^
  949.               BIO_printf(bio_err, "memory allocation failure\n");
  950.               goto err;

apps/ts.c:949:13: 
  947.           lookup = X509_STORE_add_lookup(cert_ctx, X509_LOOKUP_hash_dir());
  948.           if (lookup == NULL) {
  949. >             BIO_printf(bio_err, "memory allocation failure\n");
  950.               goto err;
  951.           }

crypto/bio/b_print.c:867:1: start of procedure BIO_printf()
    865.   /***************************************************************************/
    866.   
    867. > int BIO_printf(BIO *bio, const char *format, ...)
    868.   {
    869.       va_list args;

crypto/bio/b_print.c:872:5: 
    870.       int ret;
    871.   
    872. >     va_start(args, format);
    873.   
    874.       ret = BIO_vprintf(bio, format, args);

crypto/bio/b_print.c:874:5: Skipping BIO_vprintf(): empty list of specs
    872.       va_start(args, format);
    873.   
    874.       ret = BIO_vprintf(bio, format, args);
               ^
    875.   
    876.       va_end(args);

crypto/bio/b_print.c:876:5: 
    874.       ret = BIO_vprintf(bio, format, args);
    875.   
    876. >     va_end(args);
    877.       return (ret);
    878.   }

crypto/bio/b_print.c:877:5: 
    875.   
    876.       va_end(args);
    877. >     return (ret);
    878.   }
    879.   

crypto/bio/b_print.c:878:1: return from a call to BIO_printf
    876.       va_end(args);
    877.       return (ret);
    878. > }
    879.   
    880.   int BIO_vprintf(BIO *bio, const char *format, va_list args)

apps/ts.c:977:2: 
  975.       return cert_ctx;
  976.   
  977. >  err:
  978.       X509_STORE_free(cert_ctx);
  979.       return NULL;

apps/ts.c:978:5: Skipping X509_STORE_free(): empty list of specs
  976.   
  977.    err:
  978.       X509_STORE_free(cert_ctx);
             ^
  979.       return NULL;
  980.   }

apps/ts.c:979:5: 
  977.    err:
  978.       X509_STORE_free(cert_ctx);
  979. >     return NULL;
  980.   }
  981.   

apps/ts.c:980:1: return from a call to create_cert_store
  978.       X509_STORE_free(cert_ctx);
  979.       return NULL;
  980. > }
  981.   
  982.   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:917:9: Taking true branch
915.   
916.       /* Initialising the X509_STORE object. */
917.       if (TS_VERIFY_CTX_set_store(ctx, create_cert_store(CApath, CAfile, vpm))
               ^
918.               == NULL)
919.           goto err;

apps/ts.c:927:2: 
925.       ret = 1;
926.   
927. >  err:
928.       if (!ret) {
929.           TS_VERIFY_CTX_free(ctx);

apps/ts.c:928:10: Taking true branch
926.   
927.    err:
928.       if (!ret) {
                ^
929.           TS_VERIFY_CTX_free(ctx);
930.           ctx = NULL;

apps/ts.c:929:9: 
927.    err:
928.       if (!ret) {
929. >         TS_VERIFY_CTX_free(ctx);
930.           ctx = NULL;
931.       }

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(const char *data, const char *digest,
                                        const char *queryfile,
                                        const char *CApath, const char *CAfile,
                                        const 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(const char *data, const char *digest,\n                                        const char *queryfile,\n                                        const char *CApath, const char *CAfile,\n                                        const 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(const char *CApath, const char *CAfile,\n                                     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                              X509_STORE_CTX_verify_cb verify_cb)\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}', '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}']