apps/apps.c:1624: error: MEMORY_LEAK
  memory dynamically allocated by call to `TXT_DB_create_index()` at line 1614, column 10 is not reachable after line 1624, column 13.
Showing all 137 steps of the trace


apps/apps.c:1612:1: start of procedure index_index()
1610.   }
1611.   
1612. > int index_index(CA_DB *db)
1613.   {
1614.       if (!TXT_DB_create_index(db->db, DB_serial, NULL,

apps/apps.c:1614:10: 
1612.   int index_index(CA_DB *db)
1613.   {
1614. >     if (!TXT_DB_create_index(db->db, DB_serial, NULL,
1615.                                LHASH_HASH_FN(index_serial),
1616.                                LHASH_COMP_FN(index_serial))) {

crypto/txt_db/txt_db.c:196:1: start of procedure TXT_DB_create_index()
  194.   }
  195.   
  196. > int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *),
  197.                           LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp)
  198.   {

crypto/txt_db/txt_db.c:203:9: Taking false branch
  201.       int i, n;
  202.   
  203.       if (field >= db->num_fields) {
                 ^
  204.           db->error = DB_ERROR_INDEX_OUT_OF_RANGE;
  205.           return (0);

crypto/txt_db/txt_db.c:208:9: 
  206.       }
  207.       /* FIXME: we lose type checking at this point */
  208. >     if ((idx = (LHASH_OF(OPENSSL_STRING) *)lh_new(hash, cmp)) == NULL) {
  209.           db->error = DB_ERROR_MALLOC;
  210.           return (0);

crypto/lhash/lhash.c:113:1: start of procedure lh_new()
    111.   static LHASH_NODE **getrn(_LHASH *lh, const void *data, unsigned long *rhash);
    112.   
    113. > _LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c)
    114.   {
    115.       _LHASH *ret;

crypto/lhash/lhash.c:117:9: 
    115.       _LHASH *ret;
    116.   
    117. >     if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
    118.           goto err0;
    119.       if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)

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

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

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

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

crypto/mem.c:124:9: Taking false branch
        122.       void *ret = NULL;
        123.   
        124.       if (num <= 0)
                       ^
        125.           return NULL;
        126.   

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

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

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

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

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

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

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

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

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

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

crypto/lhash/lhash.c:117:9: Taking false branch
    115.       _LHASH *ret;
    116.   
    117.       if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
                   ^
    118.           goto err0;
    119.       if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)

crypto/lhash/lhash.c:119:9: 
    117.       if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
    118.           goto err0;
    119. >     if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
    120.           goto err1;
    121.       ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);

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

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

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

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

crypto/mem.c:124:9: Taking false branch
        122.       void *ret = NULL;
        123.   
        124.       if (num <= 0)
                       ^
        125.           return NULL;
        126.   

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

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

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

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

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

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

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

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

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

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

crypto/lhash/lhash.c:119:9: Taking false branch
    117.       if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
    118.           goto err0;
    119.       if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
                   ^
    120.           goto err1;
    121.       ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);

crypto/lhash/lhash.c:121:19: Condition is false
    119.       if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
    120.           goto err1;
    121.       ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
                             ^
    122.       ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
    123.       ret->num_nodes = MIN_NODES / 2;

crypto/lhash/lhash.c:121:18: 
    119.       if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
    120.           goto err1;
    121. >     ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
    122.       ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
    123.       ret->num_nodes = MIN_NODES / 2;

crypto/lhash/lhash.c:121:5: 
    119.       if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
    120.           goto err1;
    121. >     ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
    122.       ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
    123.       ret->num_nodes = MIN_NODES / 2;

crypto/lhash/lhash.c:122:19: Condition is false
    120.           goto err1;
    121.       ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
    122.       ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
                             ^
    123.       ret->num_nodes = MIN_NODES / 2;
    124.       ret->num_alloc_nodes = MIN_NODES;

crypto/lhash/lhash.c:122:18: 
    120.           goto err1;
    121.       ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
    122. >     ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
    123.       ret->num_nodes = MIN_NODES / 2;
    124.       ret->num_alloc_nodes = MIN_NODES;

crypto/lhash/lhash.c:122:5: 
    120.           goto err1;
    121.       ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
    122. >     ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
    123.       ret->num_nodes = MIN_NODES / 2;
    124.       ret->num_alloc_nodes = MIN_NODES;

crypto/lhash/lhash.c:123:5: 
    121.       ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
    122.       ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
    123. >     ret->num_nodes = MIN_NODES / 2;
    124.       ret->num_alloc_nodes = MIN_NODES;
    125.       ret->pmax = MIN_NODES / 2;

crypto/lhash/lhash.c:124:5: 
    122.       ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
    123.       ret->num_nodes = MIN_NODES / 2;
    124. >     ret->num_alloc_nodes = MIN_NODES;
    125.       ret->pmax = MIN_NODES / 2;
    126.       ret->up_load = UP_LOAD;

crypto/lhash/lhash.c:125:5: 
    123.       ret->num_nodes = MIN_NODES / 2;
    124.       ret->num_alloc_nodes = MIN_NODES;
    125. >     ret->pmax = MIN_NODES / 2;
    126.       ret->up_load = UP_LOAD;
    127.       ret->down_load = DOWN_LOAD;

crypto/lhash/lhash.c:126:5: 
    124.       ret->num_alloc_nodes = MIN_NODES;
    125.       ret->pmax = MIN_NODES / 2;
    126. >     ret->up_load = UP_LOAD;
    127.       ret->down_load = DOWN_LOAD;
    128.       return (ret);

crypto/lhash/lhash.c:127:5: 
    125.       ret->pmax = MIN_NODES / 2;
    126.       ret->up_load = UP_LOAD;
    127. >     ret->down_load = DOWN_LOAD;
    128.       return (ret);
    129.   

crypto/lhash/lhash.c:128:5: 
    126.       ret->up_load = UP_LOAD;
    127.       ret->down_load = DOWN_LOAD;
    128. >     return (ret);
    129.   
    130.    err1:

crypto/lhash/lhash.c:134:1: return from a call to lh_new
    132.    err0:
    133.       return (NULL);
    134. > }
    135.   
    136.   void lh_free(_LHASH *lh)

crypto/txt_db/txt_db.c:208:9: Taking false branch
  206.       }
  207.       /* FIXME: we lose type checking at this point */
  208.       if ((idx = (LHASH_OF(OPENSSL_STRING) *)lh_new(hash, cmp)) == NULL) {
                 ^
  209.           db->error = DB_ERROR_MALLOC;
  210.           return (0);

crypto/txt_db/txt_db.c:212:5: 
  210.           return (0);
  211.       }
  212. >     n = sk_OPENSSL_PSTRING_num(db->data);
  213.       for (i = 0; i < n; i++) {
  214.           r = sk_OPENSSL_PSTRING_value(db->data, i);

include/openssl/txt_db.h:80:1: start of procedure sk_OPENSSL_PSTRING_num()
    78.   
    79.   typedef OPENSSL_STRING *OPENSSL_PSTRING;
    80. > DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING)
    81.   
    82.   typedef struct txt_db_st {

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

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

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

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

include/openssl/txt_db.h:80:1: return from a call to sk_OPENSSL_PSTRING_num
    78.   
    79.   typedef OPENSSL_STRING *OPENSSL_PSTRING;
    80. > DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING)
    81.   
    82.   typedef struct txt_db_st {

crypto/txt_db/txt_db.c:213:10: 
  211.       }
  212.       n = sk_OPENSSL_PSTRING_num(db->data);
  213. >     for (i = 0; i < n; i++) {
  214.           r = sk_OPENSSL_PSTRING_value(db->data, i);
  215.           if ((qual != NULL) && (qual(r) == 0))

crypto/txt_db/txt_db.c:213:17: Loop condition is false. Leaving loop
  211.       }
  212.       n = sk_OPENSSL_PSTRING_num(db->data);
  213.       for (i = 0; i < n; i++) {
                         ^
  214.           r = sk_OPENSSL_PSTRING_value(db->data, i);
  215.           if ((qual != NULL) && (qual(r) == 0))

crypto/txt_db/txt_db.c:225:5: Condition is true
  223.           }
  224.       }
  225.       lh_OPENSSL_STRING_free(db->index[field]);
             ^
  226.       db->index[field] = idx;
  227.       db->qual[field] = qual;

crypto/txt_db/txt_db.c:226:5: 
  224.       }
  225.       lh_OPENSSL_STRING_free(db->index[field]);
  226. >     db->index[field] = idx;
  227.       db->qual[field] = qual;
  228.       return (1);

crypto/txt_db/txt_db.c:227:5: 
  225.       lh_OPENSSL_STRING_free(db->index[field]);
  226.       db->index[field] = idx;
  227. >     db->qual[field] = qual;
  228.       return (1);
  229.   }

crypto/txt_db/txt_db.c:228:5: 
  226.       db->index[field] = idx;
  227.       db->qual[field] = qual;
  228. >     return (1);
  229.   }
  230.   

crypto/txt_db/txt_db.c:229:1: return from a call to TXT_DB_create_index
  227.       db->qual[field] = qual;
  228.       return (1);
  229. > }
  230.   
  231.   long TXT_DB_write(BIO *out, TXT_DB *db)

apps/apps.c:1614:10: Taking false branch
1612.   int index_index(CA_DB *db)
1613.   {
1614.       if (!TXT_DB_create_index(db->db, DB_serial, NULL,
                 ^
1615.                                LHASH_HASH_FN(index_serial),
1616.                                LHASH_COMP_FN(index_serial))) {

apps/apps.c:1623:9: Taking true branch
1621.       }
1622.   
1623.       if (db->attributes.unique_subject
                ^
1624.           && !TXT_DB_create_index(db->db, DB_name, index_name_qual,
1625.                                   LHASH_HASH_FN(index_name),

apps/apps.c:1624:13: 
1622.   
1623.       if (db->attributes.unique_subject
1624. >         && !TXT_DB_create_index(db->db, DB_name, index_name_qual,
1625.                                   LHASH_HASH_FN(index_name),
1626.                                   LHASH_COMP_FN(index_name))) {

crypto/txt_db/txt_db.c:196:1: start of procedure TXT_DB_create_index()
  194.   }
  195.   
  196. > int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *),
  197.                           LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp)
  198.   {

crypto/txt_db/txt_db.c:203:9: Taking false branch
  201.       int i, n;
  202.   
  203.       if (field >= db->num_fields) {
                 ^
  204.           db->error = DB_ERROR_INDEX_OUT_OF_RANGE;
  205.           return (0);

crypto/txt_db/txt_db.c:208:9: 
  206.       }
  207.       /* FIXME: we lose type checking at this point */
  208. >     if ((idx = (LHASH_OF(OPENSSL_STRING) *)lh_new(hash, cmp)) == NULL) {
  209.           db->error = DB_ERROR_MALLOC;
  210.           return (0);

crypto/lhash/lhash.c:113:1: start of procedure lh_new()
    111.   static LHASH_NODE **getrn(_LHASH *lh, const void *data, unsigned long *rhash);
    112.   
    113. > _LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c)
    114.   {
    115.       _LHASH *ret;

crypto/lhash/lhash.c:117:9: 
    115.       _LHASH *ret;
    116.   
    117. >     if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
    118.           goto err0;
    119.       if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)

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

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

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

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

crypto/mem.c:124:9: Taking false branch
        122.       void *ret = NULL;
        123.   
        124.       if (num <= 0)
                       ^
        125.           return NULL;
        126.   

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

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

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

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

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

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

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

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

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

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

crypto/lhash/lhash.c:117:9: Taking false branch
    115.       _LHASH *ret;
    116.   
    117.       if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
                   ^
    118.           goto err0;
    119.       if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)

crypto/lhash/lhash.c:119:9: 
    117.       if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
    118.           goto err0;
    119. >     if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
    120.           goto err1;
    121.       ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);

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

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

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

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

crypto/mem.c:124:9: Taking false branch
        122.       void *ret = NULL;
        123.   
        124.       if (num <= 0)
                       ^
        125.           return NULL;
        126.   

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

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

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

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

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

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

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

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

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

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

crypto/lhash/lhash.c:119:9: Taking false branch
    117.       if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)
    118.           goto err0;
    119.       if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
                   ^
    120.           goto err1;
    121.       ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);

crypto/lhash/lhash.c:121:19: Condition is false
    119.       if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
    120.           goto err1;
    121.       ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
                             ^
    122.       ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
    123.       ret->num_nodes = MIN_NODES / 2;

crypto/lhash/lhash.c:121:18: 
    119.       if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
    120.           goto err1;
    121. >     ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
    122.       ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
    123.       ret->num_nodes = MIN_NODES / 2;

crypto/lhash/lhash.c:121:5: 
    119.       if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)
    120.           goto err1;
    121. >     ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
    122.       ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
    123.       ret->num_nodes = MIN_NODES / 2;

crypto/lhash/lhash.c:122:19: Condition is false
    120.           goto err1;
    121.       ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
    122.       ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
                             ^
    123.       ret->num_nodes = MIN_NODES / 2;
    124.       ret->num_alloc_nodes = MIN_NODES;

crypto/lhash/lhash.c:122:18: 
    120.           goto err1;
    121.       ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
    122. >     ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
    123.       ret->num_nodes = MIN_NODES / 2;
    124.       ret->num_alloc_nodes = MIN_NODES;

crypto/lhash/lhash.c:122:5: 
    120.           goto err1;
    121.       ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
    122. >     ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
    123.       ret->num_nodes = MIN_NODES / 2;
    124.       ret->num_alloc_nodes = MIN_NODES;

crypto/lhash/lhash.c:123:5: 
    121.       ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);
    122.       ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
    123. >     ret->num_nodes = MIN_NODES / 2;
    124.       ret->num_alloc_nodes = MIN_NODES;
    125.       ret->pmax = MIN_NODES / 2;

crypto/lhash/lhash.c:124:5: 
    122.       ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);
    123.       ret->num_nodes = MIN_NODES / 2;
    124. >     ret->num_alloc_nodes = MIN_NODES;
    125.       ret->pmax = MIN_NODES / 2;
    126.       ret->up_load = UP_LOAD;

crypto/lhash/lhash.c:125:5: 
    123.       ret->num_nodes = MIN_NODES / 2;
    124.       ret->num_alloc_nodes = MIN_NODES;
    125. >     ret->pmax = MIN_NODES / 2;
    126.       ret->up_load = UP_LOAD;
    127.       ret->down_load = DOWN_LOAD;

crypto/lhash/lhash.c:126:5: 
    124.       ret->num_alloc_nodes = MIN_NODES;
    125.       ret->pmax = MIN_NODES / 2;
    126. >     ret->up_load = UP_LOAD;
    127.       ret->down_load = DOWN_LOAD;
    128.       return (ret);

crypto/lhash/lhash.c:127:5: 
    125.       ret->pmax = MIN_NODES / 2;
    126.       ret->up_load = UP_LOAD;
    127. >     ret->down_load = DOWN_LOAD;
    128.       return (ret);
    129.   

crypto/lhash/lhash.c:128:5: 
    126.       ret->up_load = UP_LOAD;
    127.       ret->down_load = DOWN_LOAD;
    128. >     return (ret);
    129.   
    130.    err1:

crypto/lhash/lhash.c:134:1: return from a call to lh_new
    132.    err0:
    133.       return (NULL);
    134. > }
    135.   
    136.   void lh_free(_LHASH *lh)

crypto/txt_db/txt_db.c:208:9: Taking false branch
  206.       }
  207.       /* FIXME: we lose type checking at this point */
  208.       if ((idx = (LHASH_OF(OPENSSL_STRING) *)lh_new(hash, cmp)) == NULL) {
                 ^
  209.           db->error = DB_ERROR_MALLOC;
  210.           return (0);

crypto/txt_db/txt_db.c:212:5: 
  210.           return (0);
  211.       }
  212. >     n = sk_OPENSSL_PSTRING_num(db->data);
  213.       for (i = 0; i < n; i++) {
  214.           r = sk_OPENSSL_PSTRING_value(db->data, i);

include/openssl/txt_db.h:80:1: start of procedure sk_OPENSSL_PSTRING_num()
    78.   
    79.   typedef OPENSSL_STRING *OPENSSL_PSTRING;
    80. > DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING)
    81.   
    82.   typedef struct txt_db_st {

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

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

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

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

include/openssl/txt_db.h:80:1: return from a call to sk_OPENSSL_PSTRING_num
    78.   
    79.   typedef OPENSSL_STRING *OPENSSL_PSTRING;
    80. > DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING)
    81.   
    82.   typedef struct txt_db_st {

crypto/txt_db/txt_db.c:213:10: 
  211.       }
  212.       n = sk_OPENSSL_PSTRING_num(db->data);
  213. >     for (i = 0; i < n; i++) {
  214.           r = sk_OPENSSL_PSTRING_value(db->data, i);
  215.           if ((qual != NULL) && (qual(r) == 0))

crypto/txt_db/txt_db.c:213:17: Loop condition is false. Leaving loop
  211.       }
  212.       n = sk_OPENSSL_PSTRING_num(db->data);
  213.       for (i = 0; i < n; i++) {
                         ^
  214.           r = sk_OPENSSL_PSTRING_value(db->data, i);
  215.           if ((qual != NULL) && (qual(r) == 0))

crypto/txt_db/txt_db.c:225:5: Condition is true
  223.           }
  224.       }
  225.       lh_OPENSSL_STRING_free(db->index[field]);
             ^
  226.       db->index[field] = idx;
  227.       db->qual[field] = qual;

crypto/txt_db/txt_db.c:226:5: 
  224.       }
  225.       lh_OPENSSL_STRING_free(db->index[field]);
  226. >     db->index[field] = idx;
  227.       db->qual[field] = qual;
  228.       return (1);

crypto/txt_db/txt_db.c:227:5: 
  225.       lh_OPENSSL_STRING_free(db->index[field]);
  226.       db->index[field] = idx;
  227. >     db->qual[field] = qual;
  228.       return (1);
  229.   }

crypto/txt_db/txt_db.c:228:5: 
  226.       db->index[field] = idx;
  227.       db->qual[field] = qual;
  228. >     return (1);
  229.   }
  230.   

crypto/txt_db/txt_db.c:229:1: return from a call to TXT_DB_create_index
  227.       db->qual[field] = qual;
  228.       return (1);
  229. > }
  230.   
  231.   long TXT_DB_write(BIO *out, TXT_DB *db)

int index_index(CA_DB *db)
{
    if (!TXT_DB_create_index(db->db, DB_serial, NULL,
                             LHASH_HASH_FN(index_serial),
                             LHASH_COMP_FN(index_serial))) {
        BIO_printf(bio_err,
                   "error creating serial number index:(%ld,%ld,%ld)\n",
                   db->db->error, db->db->arg1, db->db->arg2);
        return 0;
    }
    if (db->attributes.unique_subject
        && !TXT_DB_create_index(db->db, DB_name, index_name_qual,
                                LHASH_HASH_FN(index_name),
                                LHASH_COMP_FN(index_name))) {
        BIO_printf(bio_err, "error creating name index:(%ld,%ld,%ld)\n",
                   db->db->error, db->db->arg1, db->db->arg2);
        return 0;
    }
    return 1;
}
['int index_index(CA_DB *db)\n{\n    if (!TXT_DB_create_index(db->db, DB_serial, NULL,\n                             LHASH_HASH_FN(index_serial),\n                             LHASH_COMP_FN(index_serial))) {\n        BIO_printf(bio_err,\n                   "error creating serial number index:(%ld,%ld,%ld)\\n",\n                   db->db->error, db->db->arg1, db->db->arg2);\n        return 0;\n    }\n    if (db->attributes.unique_subject\n        && !TXT_DB_create_index(db->db, DB_name, index_name_qual,\n                                LHASH_HASH_FN(index_name),\n                                LHASH_COMP_FN(index_name))) {\n        BIO_printf(bio_err, "error creating name index:(%ld,%ld,%ld)\\n",\n                   db->db->error, db->db->arg1, db->db->arg2);\n        return 0;\n    }\n    return 1;\n}', 'int TXT_DB_create_index(TXT_DB *db, int field, int (*qual) (OPENSSL_STRING *),\n                        LHASH_HASH_FN_TYPE hash, LHASH_COMP_FN_TYPE cmp)\n{\n    LHASH_OF(OPENSSL_STRING) *idx;\n    OPENSSL_STRING *r;\n    int i, n;\n    if (field >= db->num_fields) {\n        db->error = DB_ERROR_INDEX_OUT_OF_RANGE;\n        return (0);\n    }\n    if ((idx = (LHASH_OF(OPENSSL_STRING) *)lh_new(hash, cmp)) == NULL) {\n        db->error = DB_ERROR_MALLOC;\n        return (0);\n    }\n    n = sk_OPENSSL_PSTRING_num(db->data);\n    for (i = 0; i < n; i++) {\n        r = sk_OPENSSL_PSTRING_value(db->data, i);\n        if ((qual != NULL) && (qual(r) == 0))\n            continue;\n        if ((r = lh_OPENSSL_STRING_insert(idx, r)) != NULL) {\n            db->error = DB_ERROR_INDEX_CLASH;\n            db->arg1 = sk_OPENSSL_PSTRING_find(db->data, r);\n            db->arg2 = i;\n            lh_OPENSSL_STRING_free(idx);\n            return (0);\n        }\n    }\n    lh_OPENSSL_STRING_free(db->index[field]);\n    db->index[field] = idx;\n    db->qual[field] = qual;\n    return (1);\n}', '_LHASH *lh_new(LHASH_HASH_FN_TYPE h, LHASH_COMP_FN_TYPE c)\n{\n    _LHASH *ret;\n    if ((ret = OPENSSL_zalloc(sizeof(*ret))) == NULL)\n        goto err0;\n    if ((ret->b = OPENSSL_zalloc(sizeof(*ret->b) * MIN_NODES)) == NULL)\n        goto err1;\n    ret->comp = ((c == NULL) ? (LHASH_COMP_FN_TYPE)strcmp : c);\n    ret->hash = ((h == NULL) ? (LHASH_HASH_FN_TYPE)lh_strhash : h);\n    ret->num_nodes = MIN_NODES / 2;\n    ret->num_alloc_nodes = MIN_NODES;\n    ret->pmax = MIN_NODES / 2;\n    ret->up_load = UP_LOAD;\n    ret->down_load = DOWN_LOAD;\n    return (ret);\n err1:\n    OPENSSL_free(ret);\n err0:\n    return (NULL);\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 (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    (void)file;\n    (void)line;\n    ret = malloc(num);\n#endif\n#ifndef OPENSSL_CPUID_OBJ\n    if (ret && (num > 2048)) {\n        extern unsigned char cleanse_ctr;\n        ((unsigned char *)ret)[0] = cleanse_ctr;\n    }\n#endif\n    return ret;\n}', 'DEFINE_SPECIAL_STACK_OF(OPENSSL_PSTRING, OPENSSL_STRING)', 'int sk_num(const _STACK *st)\n{\n    if (st == NULL)\n        return -1;\n    return st->num;\n}']