crypto/x509/by_dir.c:245: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_strndup()` at line 243, column 24 is not reachable after line 245, column 17.
Showing all 96 steps of the trace


crypto/x509/by_dir.c:202:1: start of procedure add_cert_dir()
200.   }
201.   
202. > static int add_cert_dir(BY_DIR *ctx, const char *dir, int type)
203.   {
204.       const char *s, *p;

crypto/x509/by_dir.c:206:9: Taking false branch
204.       const char *s, *p;
205.   
206.       if (dir == NULL || !*dir) {
               ^
207.           X509err(X509_F_ADD_CERT_DIR, X509_R_INVALID_DIRECTORY);
208.           return 0;

crypto/x509/by_dir.c:206:25: Taking false branch
204.       const char *s, *p;
205.   
206.       if (dir == NULL || !*dir) {
                               ^
207.           X509err(X509_F_ADD_CERT_DIR, X509_R_INVALID_DIRECTORY);
208.           return 0;

crypto/x509/by_dir.c:211:5: 
209.       }
210.   
211. >     s = dir;
212.       p = s;
213.       do {

crypto/x509/by_dir.c:212:5: 
210.   
211.       s = dir;
212. >     p = s;
213.       do {
214.           if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) {

crypto/x509/by_dir.c:214:14: Taking true branch
212.       p = s;
213.       do {
214.           if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) {
                    ^
215.               BY_DIR_ENTRY *ent;
216.               int j;

crypto/x509/by_dir.c:218:13: 
216.               int j;
217.               size_t len;
218. >             const char *ss = s;
219.               s = p + 1;
220.               len = p - ss;

crypto/x509/by_dir.c:219:13: 
217.               size_t len;
218.               const char *ss = s;
219. >             s = p + 1;
220.               len = p - ss;
221.               if (len == 0)

crypto/x509/by_dir.c:220:13: 
218.               const char *ss = s;
219.               s = p + 1;
220. >             len = p - ss;
221.               if (len == 0)
222.                   continue;

crypto/x509/by_dir.c:221:17: Taking false branch
219.               s = p + 1;
220.               len = p - ss;
221.               if (len == 0)
                       ^
222.                   continue;
223.               for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) {

crypto/x509/by_dir.c:223:18: 
221.               if (len == 0)
222.                   continue;
223. >             for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) {
224.                   ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j);
225.                   if (strlen(ent->dir) == len &&

crypto/x509/by_dir.c:223:25: 
221.               if (len == 0)
222.                   continue;
223. >             for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) {
224.                   ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j);
225.                   if (strlen(ent->dir) == 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:223:25: Loop condition is false. Leaving loop
221.               if (len == 0)
222.                   continue;
223.               for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) {
                               ^
224.                   ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j);
225.                   if (strlen(ent->dir) == len &&

crypto/x509/by_dir.c:229:17: 
227.                       break;
228.               }
229. >             if (j < sk_BY_DIR_ENTRY_num(ctx->dirs))
230.                   continue;
231.               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:229:17: Taking false branch
227.                       break;
228.               }
229.               if (j < sk_BY_DIR_ENTRY_num(ctx->dirs))
                       ^
230.                   continue;
231.               if (ctx->dirs == NULL) {

crypto/x509/by_dir.c:231:17: Taking true branch
229.               if (j < sk_BY_DIR_ENTRY_num(ctx->dirs))
230.                   continue;
231.               if (ctx->dirs == NULL) {
                       ^
232.                   ctx->dirs = sk_BY_DIR_ENTRY_new_null();
233.                   if (!ctx->dirs) {

crypto/x509/by_dir.c:232:17: 
230.                   continue;
231.               if (ctx->dirs == NULL) {
232. >                 ctx->dirs = sk_BY_DIR_ENTRY_new_null();
233.                   if (!ctx->dirs) {
234.                       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: Skipping sk_new(): empty list of specs
    144.   _STACK *sk_new_null(void)
    145.   {
    146.       return sk_new((int (*)(const void *, const void *))0);
               ^
    147.   }
    148.   

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:233:22: Taking false branch
231.               if (ctx->dirs == NULL) {
232.                   ctx->dirs = sk_BY_DIR_ENTRY_new_null();
233.                   if (!ctx->dirs) {
                            ^
234.                       X509err(X509_F_ADD_CERT_DIR, ERR_R_MALLOC_FAILURE);
235.                       return 0;

crypto/x509/by_dir.c:238:13: 
236.                   }
237.               }
238. >             ent = OPENSSL_malloc(sizeof(*ent));
239.               if (ent == NULL)
240.                   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 (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:123:9: Taking true branch
  121.       void *ret = NULL;
  122.   
  123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                 ^
  124.           return malloc_impl(num, file, line);
  125.   

crypto/mem.c:123:32: Taking true branch
  121.       void *ret = NULL;
  122.   
  123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                                        ^
  124.           return malloc_impl(num, file, line);
  125.   

crypto/mem.c:124:9: Skipping __function_pointer__(): unresolved function pointer
  122.   
  123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
  124.           return malloc_impl(num, file, line);
                 ^
  125.   
  126.       if (num <= 0)

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

crypto/x509/by_dir.c:239:17: Taking false branch
237.               }
238.               ent = OPENSSL_malloc(sizeof(*ent));
239.               if (ent == NULL)
                       ^
240.                   return 0;
241.               ent->dir_type = type;

crypto/x509/by_dir.c:241:13: 
239.               if (ent == NULL)
240.                   return 0;
241. >             ent->dir_type = type;
242.               ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp);
243.               ent->dir = OPENSSL_strndup(ss, len);

crypto/x509/by_dir.c:242:13: 
240.                   return 0;
241.               ent->dir_type = type;
242. >             ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp);
243.               ent->dir = OPENSSL_strndup(ss, len);
244.               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/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:243:13: 
241.               ent->dir_type = type;
242.               ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp);
243. >             ent->dir = OPENSSL_strndup(ss, len);
244.               if (ent->dir == NULL || ent->hashes == NULL) {
245.                   by_dir_entry_free(ent);

crypto/o_str.c:134:1: start of procedure CRYPTO_strndup()
  132.   }
  133.   
  134. > char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line)
  135.   {
  136.       size_t maxlen;

crypto/o_str.c:139:9: Taking false branch
  137.       char *ret;
  138.   
  139.       if (str == NULL)
                 ^
  140.           return NULL;
  141.   

crypto/o_str.c:142:5: 
  140.           return NULL;
  141.   
  142. >     maxlen = OPENSSL_strnlen(str, s);
  143.   
  144.       ret = CRYPTO_malloc(maxlen + 1, file, line);

crypto/o_str.c:167:1: start of procedure OPENSSL_strnlen()
    165.   }
    166.   
    167. > size_t OPENSSL_strnlen(const char *str, size_t maxlen)
    168.   {
    169.       const char *p;

crypto/o_str.c:171:10: 
    169.       const char *p;
    170.   
    171. >     for (p = str; maxlen-- != 0 && *p != '\0'; ++p) ;
    172.   
    173.       return p - str;

crypto/o_str.c:171:19: Loop condition is true. Entering loop body
    169.       const char *p;
    170.   
    171.       for (p = str; maxlen-- != 0 && *p != '\0'; ++p) ;
                             ^
    172.   
    173.       return p - str;

crypto/o_str.c:171:36: Loop condition is true. Entering loop body
    169.       const char *p;
    170.   
    171.       for (p = str; maxlen-- != 0 && *p != '\0'; ++p) ;
                                              ^
    172.   
    173.       return p - str;

crypto/o_str.c:171:48: 
    169.       const char *p;
    170.   
    171. >     for (p = str; maxlen-- != 0 && *p != '\0'; ++p) ;
    172.   
    173.       return p - str;

crypto/o_str.c:171:19: Loop condition is true. Entering loop body
    169.       const char *p;
    170.   
    171.       for (p = str; maxlen-- != 0 && *p != '\0'; ++p) ;
                             ^
    172.   
    173.       return p - str;

crypto/o_str.c:171:36: Loop condition is false. Leaving loop
    169.       const char *p;
    170.   
    171.       for (p = str; maxlen-- != 0 && *p != '\0'; ++p) ;
                                              ^
    172.   
    173.       return p - str;

crypto/o_str.c:173:5: 
    171.       for (p = str; maxlen-- != 0 && *p != '\0'; ++p) ;
    172.   
    173. >     return p - str;
    174.   }
    175.   

crypto/o_str.c:174:1: return from a call to OPENSSL_strnlen
    172.   
    173.       return p - str;
    174. > }
    175.   
    176.   size_t OPENSSL_strlcpy(char *dst, const char *src, size_t size)

crypto/o_str.c:144:5: 
  142.       maxlen = OPENSSL_strnlen(str, s);
  143.   
  144. >     ret = CRYPTO_malloc(maxlen + 1, file, line);
  145.       if (ret) {
  146.           memcpy(ret, str, maxlen);

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

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

crypto/mem.c:123:9: Taking false branch
    121.       void *ret = NULL;
    122.   
    123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                   ^
    124.           return malloc_impl(num, file, line);
    125.   

crypto/mem.c:126:9: Taking false branch
    124.           return malloc_impl(num, file, line);
    125.   
    126.       if (num <= 0)
                   ^
    127.           return NULL;
    128.   

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

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

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

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

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

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

crypto/o_str.c:145:9: Taking true branch
  143.   
  144.       ret = CRYPTO_malloc(maxlen + 1, file, line);
  145.       if (ret) {
                 ^
  146.           memcpy(ret, str, maxlen);
  147.           ret[maxlen] = '\0';

crypto/o_str.c:146:9: 
  144.       ret = CRYPTO_malloc(maxlen + 1, file, line);
  145.       if (ret) {
  146. >         memcpy(ret, str, maxlen);
  147.           ret[maxlen] = '\0';
  148.       }

crypto/o_str.c:147:9: 
  145.       if (ret) {
  146.           memcpy(ret, str, maxlen);
  147. >         ret[maxlen] = '\0';
  148.       }
  149.       return ret;

crypto/o_str.c:149:5: 
  147.           ret[maxlen] = '\0';
  148.       }
  149. >     return ret;
  150.   }
  151.   

crypto/o_str.c:150:1: return from a call to CRYPTO_strndup
  148.       }
  149.       return ret;
  150. > }
  151.   
  152.   void *CRYPTO_memdup(const void *data, size_t siz, const char* file, int line)

crypto/x509/by_dir.c:244:17: Taking false branch
242.               ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp);
243.               ent->dir = OPENSSL_strndup(ss, len);
244.               if (ent->dir == NULL || ent->hashes == NULL) {
                       ^
245.                   by_dir_entry_free(ent);
246.                   return 0;

crypto/x509/by_dir.c:244:37: Taking true branch
242.               ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp);
243.               ent->dir = OPENSSL_strndup(ss, len);
244.               if (ent->dir == NULL || ent->hashes == NULL) {
                                           ^
245.                   by_dir_entry_free(ent);
246.                   return 0;

crypto/x509/by_dir.c:245:17: 
243.               ent->dir = OPENSSL_strndup(ss, len);
244.               if (ent->dir == NULL || ent->hashes == NULL) {
245. >                 by_dir_entry_free(ent);
246.                   return 0;
247.               }

crypto/x509/by_dir.c:184:1: start of procedure by_dir_entry_free()
  182.   }
  183.   
  184. > static void by_dir_entry_free(BY_DIR_ENTRY *ent)
  185.   {
  186.       OPENSSL_free(ent->dir);

crypto/x509/by_dir.c:186:5: 
  184.   static void by_dir_entry_free(BY_DIR_ENTRY *ent)
  185.   {
  186. >     OPENSSL_free(ent->dir);
  187.       sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free);
  188.       OPENSSL_free(ent);

crypto/mem.c:210:1: start of procedure CRYPTO_free()
    208.   }
    209.   
    210. > void CRYPTO_free(void *str, const char *file, int line)
    211.   {
    212.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

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

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

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

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

crypto/mem.c:228:1: return from a call to CRYPTO_free
    226.       free(str);
    227.   #endif
    228. > }
    229.   
    230.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/x509/by_dir.c:187:5: 
  185.   {
  186.       OPENSSL_free(ent->dir);
  187. >     sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free);
  188.       OPENSSL_free(ent);
  189.   }

crypto/x509/x509_lcl.h:118:1: start of procedure sk_BY_DIR_HASH_pop_free()
    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/x509_lcl.h:118:1: return from a call to sk_BY_DIR_HASH_pop_free
    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:188:5: 
  186.       OPENSSL_free(ent->dir);
  187.       sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free);
  188. >     OPENSSL_free(ent);
  189.   }
  190.   

crypto/mem.c:210:1: start of procedure CRYPTO_free()
    208.   }
    209.   
    210. > void CRYPTO_free(void *str, const char *file, int line)
    211.   {
    212.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

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

crypto/mem.c:226:5: 
    224.       }
    225.   #else
    226. >     free(str);
    227.   #endif
    228.   }

crypto/mem.c:228:1: return from a call to CRYPTO_free
    226.       free(str);
    227.   #endif
    228. > }
    229.   
    230.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/x509/by_dir.c:189:1: return from a call to by_dir_entry_free
  187.       sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free);
  188.       OPENSSL_free(ent);
  189. > }
  190.   
  191.   static void free_dir(X509_LOOKUP *lu)

static int add_cert_dir(BY_DIR *ctx, const char *dir, int type)
{
    const char *s, *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;
            int j;
            size_t len;
            const char *ss = s;
            s = p + 1;
            len = 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) == len &&
                    strncmp(ent->dir, ss, 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_strndup(ss, len);
            if (ent->dir == NULL || ent->hashes == NULL) {
                by_dir_entry_free(ent);
                return 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    const char *s, *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            int j;\n            size_t len;\n            const char *ss = s;\n            s = p + 1;\n            len = 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) == len &&\n                    strncmp(ent->dir, ss, 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_strndup(ss, len);\n            if (ent->dir == NULL || ent->hashes == NULL) {\n                by_dir_entry_free(ent);\n                return 0;\n            }\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}', '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}', "char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line)\n{\n    size_t maxlen;\n    char *ret;\n    if (str == NULL)\n        return NULL;\n    maxlen = OPENSSL_strnlen(str, s);\n    ret = CRYPTO_malloc(maxlen + 1, file, line);\n    if (ret) {\n        memcpy(ret, str, maxlen);\n        ret[maxlen] = '\\0';\n    }\n    return ret;\n}", "size_t OPENSSL_strnlen(const char *str, size_t maxlen)\n{\n    const char *p;\n    for (p = str; maxlen-- != 0 && *p != '\\0'; ++p) ;\n    return p - str;\n}", 'static void by_dir_entry_free(BY_DIR_ENTRY *ent)\n{\n    OPENSSL_free(ent->dir);\n    sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free);\n    OPENSSL_free(ent);\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}']