crypto/x509/by_dir.c:214: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_malloc()` at line 228, column 19 is not reachable after line 214, column 23.
Showing all 183 steps of the trace


crypto/x509/by_dir.c:193:1: start of procedure add_cert_dir()
191.   }
192.   
193. > static int add_cert_dir(BY_DIR *ctx, const char *dir, int type)
194.   {
195.       int j, len;

crypto/x509/by_dir.c:198:9: Taking false branch
196.       const char *s, *ss, *p;
197.   
198.       if (dir == NULL || !*dir) {
               ^
199.           X509err(X509_F_ADD_CERT_DIR, X509_R_INVALID_DIRECTORY);
200.           return 0;

crypto/x509/by_dir.c:198:25: Taking false branch
196.       const char *s, *ss, *p;
197.   
198.       if (dir == NULL || !*dir) {
                               ^
199.           X509err(X509_F_ADD_CERT_DIR, X509_R_INVALID_DIRECTORY);
200.           return 0;

crypto/x509/by_dir.c:203:5: 
201.       }
202.   
203. >     s = dir;
204.       p = s;
205.       do {

crypto/x509/by_dir.c:204:5: 
202.   
203.       s = dir;
204. >     p = s;
205.       do {
206.           if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) {

crypto/x509/by_dir.c:206:14: Taking true branch
204.       p = s;
205.       do {
206.           if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) {
                    ^
207.               BY_DIR_ENTRY *ent;
208.               ss = s;

crypto/x509/by_dir.c:208:13: 
206.           if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) {
207.               BY_DIR_ENTRY *ent;
208. >             ss = s;
209.               s = p + 1;
210.               len = (int)(p - ss);

crypto/x509/by_dir.c:209:13: 
207.               BY_DIR_ENTRY *ent;
208.               ss = s;
209. >             s = p + 1;
210.               len = (int)(p - ss);
211.               if (len == 0)

crypto/x509/by_dir.c:210:13: 
208.               ss = s;
209.               s = p + 1;
210. >             len = (int)(p - ss);
211.               if (len == 0)
212.                   continue;

crypto/x509/by_dir.c:211:17: Taking false branch
209.               s = p + 1;
210.               len = (int)(p - ss);
211.               if (len == 0)
                       ^
212.                   continue;
213.               for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) {

crypto/x509/by_dir.c:213:18: 
211.               if (len == 0)
212.                   continue;
213. >             for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) {
214.                   ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j);
215.                   if (strlen(ent->dir) == (size_t)len &&

crypto/x509/by_dir.c:213:25: 
211.               if (len == 0)
212.                   continue;
213. >             for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) {
214.                   ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j);
215.                   if (strlen(ent->dir) == (size_t)len &&

crypto/x509/x509_lcl.h:119:1: start of procedure sk_BY_DIR_ENTRY_num()
  117.   typedef struct lookup_dir_entry_st BY_DIR_ENTRY;
  118.   DEFINE_STACK_OF(BY_DIR_HASH)
  119. > DEFINE_STACK_OF(BY_DIR_ENTRY)
  120.   typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY;
  121.   DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY)

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

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

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

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

crypto/x509/x509_lcl.h:119:1: return from a call to sk_BY_DIR_ENTRY_num
  117.   typedef struct lookup_dir_entry_st BY_DIR_ENTRY;
  118.   DEFINE_STACK_OF(BY_DIR_HASH)
  119. > DEFINE_STACK_OF(BY_DIR_ENTRY)
  120.   typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY;
  121.   DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY)

crypto/x509/by_dir.c:213:25: Loop condition is false. Leaving loop
211.               if (len == 0)
212.                   continue;
213.               for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) {
                               ^
214.                   ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j);
215.                   if (strlen(ent->dir) == (size_t)len &&

crypto/x509/by_dir.c:219:17: 
217.                       break;
218.               }
219. >             if (j < sk_BY_DIR_ENTRY_num(ctx->dirs))
220.                   continue;
221.               if (ctx->dirs == NULL) {

crypto/x509/x509_lcl.h:119:1: start of procedure sk_BY_DIR_ENTRY_num()
  117.   typedef struct lookup_dir_entry_st BY_DIR_ENTRY;
  118.   DEFINE_STACK_OF(BY_DIR_HASH)
  119. > DEFINE_STACK_OF(BY_DIR_ENTRY)
  120.   typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY;
  121.   DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY)

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

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

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

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

crypto/x509/x509_lcl.h:119:1: return from a call to sk_BY_DIR_ENTRY_num
  117.   typedef struct lookup_dir_entry_st BY_DIR_ENTRY;
  118.   DEFINE_STACK_OF(BY_DIR_HASH)
  119. > DEFINE_STACK_OF(BY_DIR_ENTRY)
  120.   typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY;
  121.   DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY)

crypto/x509/by_dir.c:219:17: Taking false branch
217.                       break;
218.               }
219.               if (j < sk_BY_DIR_ENTRY_num(ctx->dirs))
                       ^
220.                   continue;
221.               if (ctx->dirs == NULL) {

crypto/x509/by_dir.c:221:17: Taking true branch
219.               if (j < sk_BY_DIR_ENTRY_num(ctx->dirs))
220.                   continue;
221.               if (ctx->dirs == NULL) {
                       ^
222.                   ctx->dirs = sk_BY_DIR_ENTRY_new_null();
223.                   if (!ctx->dirs) {

crypto/x509/by_dir.c:222:17: 
220.                   continue;
221.               if (ctx->dirs == NULL) {
222. >                 ctx->dirs = sk_BY_DIR_ENTRY_new_null();
223.                   if (!ctx->dirs) {
224.                       X509err(X509_F_ADD_CERT_DIR, ERR_R_MALLOC_FAILURE);

crypto/x509/x509_lcl.h:119:1: start of procedure sk_BY_DIR_ENTRY_new_null()
  117.   typedef struct lookup_dir_entry_st BY_DIR_ENTRY;
  118.   DEFINE_STACK_OF(BY_DIR_HASH)
  119. > DEFINE_STACK_OF(BY_DIR_ENTRY)
  120.   typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY;
  121.   DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY)

crypto/stack/stack.c:144:1: start of procedure sk_new_null()
    142.   }
    143.   
    144. > _STACK *sk_new_null(void)
    145.   {
    146.       return sk_new((int (*)(const void *, const void *))0);

crypto/stack/stack.c:146:5: 
    144.   _STACK *sk_new_null(void)
    145.   {
    146. >     return sk_new((int (*)(const void *, const void *))0);
    147.   }
    148.   

crypto/stack/stack.c:149:1: start of procedure sk_new()
      147.   }
      148.   
      149. > _STACK *sk_new(int (*c) (const void *, const void *))
      150.   {
      151.       _STACK *ret;

crypto/stack/stack.c:153:9: 
      151.       _STACK *ret;
      152.   
      153. >     if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL)
      154.           goto err;
      155.       if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

crypto/stack/stack.c:153:9: Taking false branch
      151.       _STACK *ret;
      152.   
      153.       if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL)
                     ^
      154.           goto err;
      155.       if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL)

crypto/stack/stack.c:155:9: 
      153.       if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL)
      154.           goto err;
      155. >     if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL)
      156.           goto err;
      157.       ret->comp = c;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

crypto/stack/stack.c:155:9: Taking false branch
      153.       if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL)
      154.           goto err;
      155.       if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL)
                     ^
      156.           goto err;
      157.       ret->comp = c;

crypto/stack/stack.c:157:5: 
      155.       if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL)
      156.           goto err;
      157. >     ret->comp = c;
      158.       ret->num_alloc = MIN_NODES;
      159.       return (ret);

crypto/stack/stack.c:158:5: 
      156.           goto err;
      157.       ret->comp = c;
      158. >     ret->num_alloc = MIN_NODES;
      159.       return (ret);
      160.   

crypto/stack/stack.c:159:5: 
      157.       ret->comp = c;
      158.       ret->num_alloc = MIN_NODES;
      159. >     return (ret);
      160.   
      161.    err:

crypto/stack/stack.c:164:1: return from a call to sk_new
      162.       OPENSSL_free(ret);
      163.       return (NULL);
      164. > }
      165.   
      166.   int sk_insert(_STACK *st, void *data, int loc)

crypto/stack/stack.c:147:1: return from a call to sk_new_null
    145.   {
    146.       return sk_new((int (*)(const void *, const void *))0);
    147. > }
    148.   
    149.   _STACK *sk_new(int (*c) (const void *, const void *))

crypto/x509/x509_lcl.h:119:1: return from a call to sk_BY_DIR_ENTRY_new_null
  117.   typedef struct lookup_dir_entry_st BY_DIR_ENTRY;
  118.   DEFINE_STACK_OF(BY_DIR_HASH)
  119. > DEFINE_STACK_OF(BY_DIR_ENTRY)
  120.   typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY;
  121.   DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY)

crypto/x509/by_dir.c:223:22: Taking false branch
221.               if (ctx->dirs == NULL) {
222.                   ctx->dirs = sk_BY_DIR_ENTRY_new_null();
223.                   if (!ctx->dirs) {
                            ^
224.                       X509err(X509_F_ADD_CERT_DIR, ERR_R_MALLOC_FAILURE);
225.                       return 0;

crypto/x509/by_dir.c:228:13: 
226.                   }
227.               }
228. >             ent = OPENSSL_malloc(sizeof(*ent));
229.               if (ent == NULL)
230.                   return 0;

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

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

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

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

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

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

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

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

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

crypto/x509/by_dir.c:229:17: Taking false branch
227.               }
228.               ent = OPENSSL_malloc(sizeof(*ent));
229.               if (ent == NULL)
                       ^
230.                   return 0;
231.               ent->dir_type = type;

crypto/x509/by_dir.c:231:13: 
229.               if (ent == NULL)
230.                   return 0;
231. >             ent->dir_type = type;
232.               ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp);
233.               ent->dir = OPENSSL_malloc((unsigned int)len + 1);

crypto/x509/by_dir.c:232:13: 
230.                   return 0;
231.               ent->dir_type = type;
232. >             ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp);
233.               ent->dir = OPENSSL_malloc((unsigned int)len + 1);
234.               if (ent->dir == NULL || ent->hashes == NULL) {

crypto/x509/x509_lcl.h:118:1: start of procedure sk_BY_DIR_HASH_new()
  116.   typedef struct lookup_dir_hashes_st BY_DIR_HASH;
  117.   typedef struct lookup_dir_entry_st BY_DIR_ENTRY;
  118. > DEFINE_STACK_OF(BY_DIR_HASH)
  119.   DEFINE_STACK_OF(BY_DIR_ENTRY)
  120.   typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY;

crypto/stack/stack.c:149:1: start of procedure sk_new()
    147.   }
    148.   
    149. > _STACK *sk_new(int (*c) (const void *, const void *))
    150.   {
    151.       _STACK *ret;

crypto/stack/stack.c:153:9: 
    151.       _STACK *ret;
    152.   
    153. >     if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL)
    154.           goto err;
    155.       if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

crypto/stack/stack.c:153:9: Taking false branch
    151.       _STACK *ret;
    152.   
    153.       if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL)
                   ^
    154.           goto err;
    155.       if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL)

crypto/stack/stack.c:155:9: 
    153.       if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL)
    154.           goto err;
    155. >     if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL)
    156.           goto err;
    157.       ret->comp = c;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

crypto/stack/stack.c:155:9: Taking false branch
    153.       if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL)
    154.           goto err;
    155.       if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL)
                   ^
    156.           goto err;
    157.       ret->comp = c;

crypto/stack/stack.c:157:5: 
    155.       if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL)
    156.           goto err;
    157. >     ret->comp = c;
    158.       ret->num_alloc = MIN_NODES;
    159.       return (ret);

crypto/stack/stack.c:158:5: 
    156.           goto err;
    157.       ret->comp = c;
    158. >     ret->num_alloc = MIN_NODES;
    159.       return (ret);
    160.   

crypto/stack/stack.c:159:5: 
    157.       ret->comp = c;
    158.       ret->num_alloc = MIN_NODES;
    159. >     return (ret);
    160.   
    161.    err:

crypto/stack/stack.c:164:1: return from a call to sk_new
    162.       OPENSSL_free(ret);
    163.       return (NULL);
    164. > }
    165.   
    166.   int sk_insert(_STACK *st, void *data, int loc)

crypto/x509/x509_lcl.h:118:1: return from a call to sk_BY_DIR_HASH_new
  116.   typedef struct lookup_dir_hashes_st BY_DIR_HASH;
  117.   typedef struct lookup_dir_entry_st BY_DIR_ENTRY;
  118. > DEFINE_STACK_OF(BY_DIR_HASH)
  119.   DEFINE_STACK_OF(BY_DIR_ENTRY)
  120.   typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY;

crypto/x509/by_dir.c:233:13: 
231.               ent->dir_type = type;
232.               ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp);
233. >             ent->dir = OPENSSL_malloc((unsigned int)len + 1);
234.               if (ent->dir == NULL || ent->hashes == NULL) {
235.                   by_dir_entry_free(ent);

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

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

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

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

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

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

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

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

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

crypto/x509/by_dir.c:234:17: Taking false branch
232.               ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp);
233.               ent->dir = OPENSSL_malloc((unsigned int)len + 1);
234.               if (ent->dir == NULL || ent->hashes == NULL) {
                       ^
235.                   by_dir_entry_free(ent);
236.                   return 0;

crypto/x509/by_dir.c:234:37: Taking false branch
232.               ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp);
233.               ent->dir = OPENSSL_malloc((unsigned int)len + 1);
234.               if (ent->dir == NULL || ent->hashes == NULL) {
                                           ^
235.                   by_dir_entry_free(ent);
236.                   return 0;

crypto/x509/by_dir.c:238:13: 
236.                   return 0;
237.               }
238. >             strncpy(ent->dir, ss, (unsigned int)len);
239.               ent->dir[len] = '\0';
240.               if (!sk_BY_DIR_ENTRY_push(ctx->dirs, ent)) {

crypto/x509/by_dir.c:239:13: 
237.               }
238.               strncpy(ent->dir, ss, (unsigned int)len);
239. >             ent->dir[len] = '\0';
240.               if (!sk_BY_DIR_ENTRY_push(ctx->dirs, ent)) {
241.                   by_dir_entry_free(ent);

crypto/x509/by_dir.c:240:18: 
238.               strncpy(ent->dir, ss, (unsigned int)len);
239.               ent->dir[len] = '\0';
240. >             if (!sk_BY_DIR_ENTRY_push(ctx->dirs, ent)) {
241.                   by_dir_entry_free(ent);
242.                   return 0;

crypto/x509/x509_lcl.h:119:1: start of procedure sk_BY_DIR_ENTRY_push()
  117.   typedef struct lookup_dir_entry_st BY_DIR_ENTRY;
  118.   DEFINE_STACK_OF(BY_DIR_HASH)
  119. > DEFINE_STACK_OF(BY_DIR_ENTRY)
  120.   typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY;
  121.   DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY)

crypto/stack/stack.c:258:1: start of procedure sk_push()
    256.   }
    257.   
    258. > int sk_push(_STACK *st, void *data)
    259.   {
    260.       return (sk_insert(st, data, st->num));

crypto/stack/stack.c:260:5: 
    258.   int sk_push(_STACK *st, void *data)
    259.   {
    260. >     return (sk_insert(st, data, st->num));
    261.   }
    262.   

crypto/stack/stack.c:166:1: start of procedure sk_insert()
      164.   }
      165.   
      166. > int sk_insert(_STACK *st, void *data, int loc)
      167.   {
      168.       char **s;

crypto/stack/stack.c:170:9: Taking false branch
      168.       char **s;
      169.   
      170.       if (st == NULL)
                     ^
      171.           return 0;
      172.       if (st->num_alloc <= st->num + 1) {

crypto/stack/stack.c:172:9: Taking false branch
      170.       if (st == NULL)
      171.           return 0;
      172.       if (st->num_alloc <= st->num + 1) {
                     ^
      173.           s = OPENSSL_realloc((char *)st->data,
      174.                               (unsigned int)sizeof(char *) * st->num_alloc * 2);

crypto/stack/stack.c:180:10: Taking true branch
      178.           st->num_alloc *= 2;
      179.       }
      180.       if ((loc >= (int)st->num) || (loc < 0))
                      ^
      181.           st->data[st->num] = data;
      182.       else {

crypto/stack/stack.c:181:9: 
      179.       }
      180.       if ((loc >= (int)st->num) || (loc < 0))
      181. >         st->data[st->num] = data;
      182.       else {
      183.           memmove(&(st->data[loc + 1]),

crypto/stack/stack.c:187:5: 
      185.           st->data[loc] = data;
      186.       }
      187. >     st->num++;
      188.       st->sorted = 0;
      189.       return (st->num);

crypto/stack/stack.c:188:5: 
      186.       }
      187.       st->num++;
      188. >     st->sorted = 0;
      189.       return (st->num);
      190.   }

crypto/stack/stack.c:189:5: 
      187.       st->num++;
      188.       st->sorted = 0;
      189. >     return (st->num);
      190.   }
      191.   

crypto/stack/stack.c:190:1: return from a call to sk_insert
      188.       st->sorted = 0;
      189.       return (st->num);
      190. > }
      191.   
      192.   void *sk_delete_ptr(_STACK *st, void *p)

crypto/stack/stack.c:261:1: return from a call to sk_push
    259.   {
    260.       return (sk_insert(st, data, st->num));
    261. > }
    262.   
    263.   int sk_unshift(_STACK *st, void *data)

crypto/x509/x509_lcl.h:119:1: return from a call to sk_BY_DIR_ENTRY_push
  117.   typedef struct lookup_dir_entry_st BY_DIR_ENTRY;
  118.   DEFINE_STACK_OF(BY_DIR_HASH)
  119. > DEFINE_STACK_OF(BY_DIR_ENTRY)
  120.   typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY;
  121.   DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY)

crypto/x509/by_dir.c:240:18: Taking false branch
238.               strncpy(ent->dir, ss, (unsigned int)len);
239.               ent->dir[len] = '\0';
240.               if (!sk_BY_DIR_ENTRY_push(ctx->dirs, ent)) {
                        ^
241.                   by_dir_entry_free(ent);
242.                   return 0;

crypto/x509/by_dir.c:245:14: Loop condition is true. Entering loop body
243.               }
244.           }
245.       } while (*p++ != '\0');
                    ^
246.       return 1;
247.   }

crypto/x509/by_dir.c:206:14: Taking false branch
204.       p = s;
205.       do {
206.           if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) {
                    ^
207.               BY_DIR_ENTRY *ent;
208.               ss = s;

crypto/x509/by_dir.c:206:45: Taking true branch
204.       p = s;
205.       do {
206.           if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) {
                                                   ^
207.               BY_DIR_ENTRY *ent;
208.               ss = s;

crypto/x509/by_dir.c:208:13: 
206.           if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) {
207.               BY_DIR_ENTRY *ent;
208. >             ss = s;
209.               s = p + 1;
210.               len = (int)(p - ss);

crypto/x509/by_dir.c:209:13: 
207.               BY_DIR_ENTRY *ent;
208.               ss = s;
209. >             s = p + 1;
210.               len = (int)(p - ss);
211.               if (len == 0)

crypto/x509/by_dir.c:210:13: 
208.               ss = s;
209.               s = p + 1;
210. >             len = (int)(p - ss);
211.               if (len == 0)
212.                   continue;

crypto/x509/by_dir.c:211:17: Taking false branch
209.               s = p + 1;
210.               len = (int)(p - ss);
211.               if (len == 0)
                       ^
212.                   continue;
213.               for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) {

crypto/x509/by_dir.c:213:18: 
211.               if (len == 0)
212.                   continue;
213. >             for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) {
214.                   ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j);
215.                   if (strlen(ent->dir) == (size_t)len &&

crypto/x509/by_dir.c:213:25: 
211.               if (len == 0)
212.                   continue;
213. >             for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) {
214.                   ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j);
215.                   if (strlen(ent->dir) == (size_t)len &&

crypto/x509/x509_lcl.h:119:1: start of procedure sk_BY_DIR_ENTRY_num()
  117.   typedef struct lookup_dir_entry_st BY_DIR_ENTRY;
  118.   DEFINE_STACK_OF(BY_DIR_HASH)
  119. > DEFINE_STACK_OF(BY_DIR_ENTRY)
  120.   typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY;
  121.   DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY)

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

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

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

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

crypto/x509/x509_lcl.h:119:1: return from a call to sk_BY_DIR_ENTRY_num
  117.   typedef struct lookup_dir_entry_st BY_DIR_ENTRY;
  118.   DEFINE_STACK_OF(BY_DIR_HASH)
  119. > DEFINE_STACK_OF(BY_DIR_ENTRY)
  120.   typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY;
  121.   DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY)

crypto/x509/by_dir.c:213:25: Loop condition is true. Entering loop body
211.               if (len == 0)
212.                   continue;
213.               for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) {
                               ^
214.                   ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j);
215.                   if (strlen(ent->dir) == (size_t)len &&

crypto/x509/by_dir.c:214:17: 
212.                   continue;
213.               for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) {
214. >                 ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j);
215.                   if (strlen(ent->dir) == (size_t)len &&
216.                       strncmp(ent->dir, ss, (unsigned int)len) == 0)

crypto/x509/x509_lcl.h:119:1: start of procedure sk_BY_DIR_ENTRY_value()
  117.   typedef struct lookup_dir_entry_st BY_DIR_ENTRY;
  118.   DEFINE_STACK_OF(BY_DIR_HASH)
  119. > DEFINE_STACK_OF(BY_DIR_ENTRY)
  120.   typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY;
  121.   DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY)

crypto/stack/stack.c:323:1: start of procedure sk_value()
    321.   }
    322.   
    323. > void *sk_value(const _STACK *st, int i)
    324.   {
    325.       if (!st || (i < 0) || (i >= st->num))

crypto/stack/stack.c:325:10: Taking false branch
    323.   void *sk_value(const _STACK *st, int i)
    324.   {
    325.       if (!st || (i < 0) || (i >= st->num))
                    ^
    326.           return NULL;
    327.       return st->data[i];

crypto/stack/stack.c:325:17: Taking false branch
    323.   void *sk_value(const _STACK *st, int i)
    324.   {
    325.       if (!st || (i < 0) || (i >= st->num))
                           ^
    326.           return NULL;
    327.       return st->data[i];

crypto/stack/stack.c:325:28: Taking false branch
    323.   void *sk_value(const _STACK *st, int i)
    324.   {
    325.       if (!st || (i < 0) || (i >= st->num))
                                      ^
    326.           return NULL;
    327.       return st->data[i];

crypto/stack/stack.c:327:5: 
    325.       if (!st || (i < 0) || (i >= st->num))
    326.           return NULL;
    327. >     return st->data[i];
    328.   }
    329.   

crypto/stack/stack.c:328:1: return from a call to sk_value
    326.           return NULL;
    327.       return st->data[i];
    328. > }
    329.   
    330.   void *sk_set(_STACK *st, int i, void *value)

crypto/x509/x509_lcl.h:119:1: return from a call to sk_BY_DIR_ENTRY_value
  117.   typedef struct lookup_dir_entry_st BY_DIR_ENTRY;
  118.   DEFINE_STACK_OF(BY_DIR_HASH)
  119. > DEFINE_STACK_OF(BY_DIR_ENTRY)
  120.   typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY;
  121.   DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY)

static int add_cert_dir(BY_DIR *ctx, const char *dir, int type)
{
    int j, len;
    const char *s, *ss, *p;
    if (dir == NULL || !*dir) {
        X509err(X509_F_ADD_CERT_DIR, X509_R_INVALID_DIRECTORY);
        return 0;
    }
    s = dir;
    p = s;
    do {
        if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) {
            BY_DIR_ENTRY *ent;
            ss = s;
            s = p + 1;
            len = (int)(p - ss);
            if (len == 0)
                continue;
            for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) {
                ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j);
                if (strlen(ent->dir) == (size_t)len &&
                    strncmp(ent->dir, ss, (unsigned int)len) == 0)
                    break;
            }
            if (j < sk_BY_DIR_ENTRY_num(ctx->dirs))
                continue;
            if (ctx->dirs == NULL) {
                ctx->dirs = sk_BY_DIR_ENTRY_new_null();
                if (!ctx->dirs) {
                    X509err(X509_F_ADD_CERT_DIR, ERR_R_MALLOC_FAILURE);
                    return 0;
                }
            }
            ent = OPENSSL_malloc(sizeof(*ent));
            if (ent == NULL)
                return 0;
            ent->dir_type = type;
            ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp);
            ent->dir = OPENSSL_malloc((unsigned int)len + 1);
            if (ent->dir == NULL || ent->hashes == NULL) {
                by_dir_entry_free(ent);
                return 0;
            }
            strncpy(ent->dir, ss, (unsigned int)len);
            ent->dir[len] = '\0';
            if (!sk_BY_DIR_ENTRY_push(ctx->dirs, ent)) {
                by_dir_entry_free(ent);
                return 0;
            }
        }
    } while (*p++ != '\0');
    return 1;
}
["static int add_cert_dir(BY_DIR *ctx, const char *dir, int type)\n{\n    int j, len;\n    const char *s, *ss, *p;\n    if (dir == NULL || !*dir) {\n        X509err(X509_F_ADD_CERT_DIR, X509_R_INVALID_DIRECTORY);\n        return 0;\n    }\n    s = dir;\n    p = s;\n    do {\n        if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\\0')) {\n            BY_DIR_ENTRY *ent;\n            ss = s;\n            s = p + 1;\n            len = (int)(p - ss);\n            if (len == 0)\n                continue;\n            for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) {\n                ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j);\n                if (strlen(ent->dir) == (size_t)len &&\n                    strncmp(ent->dir, ss, (unsigned int)len) == 0)\n                    break;\n            }\n            if (j < sk_BY_DIR_ENTRY_num(ctx->dirs))\n                continue;\n            if (ctx->dirs == NULL) {\n                ctx->dirs = sk_BY_DIR_ENTRY_new_null();\n                if (!ctx->dirs) {\n                    X509err(X509_F_ADD_CERT_DIR, ERR_R_MALLOC_FAILURE);\n                    return 0;\n                }\n            }\n            ent = OPENSSL_malloc(sizeof(*ent));\n            if (ent == NULL)\n                return 0;\n            ent->dir_type = type;\n            ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp);\n            ent->dir = OPENSSL_malloc((unsigned int)len + 1);\n            if (ent->dir == NULL || ent->hashes == NULL) {\n                by_dir_entry_free(ent);\n                return 0;\n            }\n            strncpy(ent->dir, ss, (unsigned int)len);\n            ent->dir[len] = '\\0';\n            if (!sk_BY_DIR_ENTRY_push(ctx->dirs, ent)) {\n                by_dir_entry_free(ent);\n                return 0;\n            }\n        }\n    } while (*p++ != '\\0');\n    return 1;\n}", 'int sk_num(const _STACK *st)\n{\n    if (st == NULL)\n        return -1;\n    return st->num;\n}', '_STACK *sk_new_null(void)\n{\n    return sk_new((int (*)(const void *, const void *))0);\n}', '_STACK *sk_new(int (*c) (const void *, const void *))\n{\n    _STACK *ret;\n    if ((ret = OPENSSL_zalloc(sizeof(_STACK))) == NULL)\n        goto err;\n    if ((ret->data = OPENSSL_zalloc(sizeof(*ret->data) * MIN_NODES)) == NULL)\n        goto err;\n    ret->comp = c;\n    ret->num_alloc = MIN_NODES;\n    return (ret);\n err:\n    OPENSSL_free(ret);\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}', 'int sk_push(_STACK *st, void *data)\n{\n    return (sk_insert(st, data, st->num));\n}', 'int sk_insert(_STACK *st, void *data, int loc)\n{\n    char **s;\n    if (st == NULL)\n        return 0;\n    if (st->num_alloc <= st->num + 1) {\n        s = OPENSSL_realloc((char *)st->data,\n                            (unsigned int)sizeof(char *) * st->num_alloc * 2);\n        if (s == NULL)\n            return (0);\n        st->data = s;\n        st->num_alloc *= 2;\n    }\n    if ((loc >= (int)st->num) || (loc < 0))\n        st->data[st->num] = data;\n    else {\n        memmove(&(st->data[loc + 1]),\n                &(st->data[loc]), sizeof(char *) * (st->num - loc));\n        st->data[loc] = data;\n    }\n    st->num++;\n    st->sorted = 0;\n    return (st->num);\n}', 'void *sk_value(const _STACK *st, int i)\n{\n    if (!st || (i < 0) || (i >= st->num))\n        return NULL;\n    return st->data[i];\n}']