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


crypto/x509/by_dir.c:153:1: start of procedure add_cert_dir()
151.   }
152.   
153. > static int add_cert_dir(BY_DIR *ctx, const char *dir, int type)
154.   {
155.       const char *s, *p;

crypto/x509/by_dir.c:157:9: Taking false branch
155.       const char *s, *p;
156.   
157.       if (dir == NULL || !*dir) {
               ^
158.           X509err(X509_F_ADD_CERT_DIR, X509_R_INVALID_DIRECTORY);
159.           return 0;

crypto/x509/by_dir.c:157:25: Taking false branch
155.       const char *s, *p;
156.   
157.       if (dir == NULL || !*dir) {
                               ^
158.           X509err(X509_F_ADD_CERT_DIR, X509_R_INVALID_DIRECTORY);
159.           return 0;

crypto/x509/by_dir.c:162:5: 
160.       }
161.   
162. >     s = dir;
163.       p = s;
164.       do {

crypto/x509/by_dir.c:163:5: 
161.   
162.       s = dir;
163. >     p = s;
164.       do {
165.           if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) {

crypto/x509/by_dir.c:165:14: Taking true branch
163.       p = s;
164.       do {
165.           if ((*p == LIST_SEPARATOR_CHAR) || (*p == '\0')) {
                    ^
166.               BY_DIR_ENTRY *ent;
167.               int j;

crypto/x509/by_dir.c:169:13: 
167.               int j;
168.               size_t len;
169. >             const char *ss = s;
170.               s = p + 1;
171.               len = p - ss;

crypto/x509/by_dir.c:170:13: 
168.               size_t len;
169.               const char *ss = s;
170. >             s = p + 1;
171.               len = p - ss;
172.               if (len == 0)

crypto/x509/by_dir.c:171:13: 
169.               const char *ss = s;
170.               s = p + 1;
171. >             len = p - ss;
172.               if (len == 0)
173.                   continue;

crypto/x509/by_dir.c:172:17: Taking false branch
170.               s = p + 1;
171.               len = p - ss;
172.               if (len == 0)
                       ^
173.                   continue;
174.               for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) {

crypto/x509/by_dir.c:174:18: 
172.               if (len == 0)
173.                   continue;
174. >             for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) {
175.                   ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j);
176.                   if (strlen(ent->dir) == len &&

crypto/x509/by_dir.c:174:25: 
172.               if (len == 0)
173.                   continue;
174. >             for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) {
175.                   ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j);
176.                   if (strlen(ent->dir) == len &&

crypto/x509/x509_lcl.h:142:1: start of procedure sk_BY_DIR_ENTRY_num()
  140.   typedef struct lookup_dir_entry_st BY_DIR_ENTRY;
  141.   DEFINE_STACK_OF(BY_DIR_HASH)
  142. > DEFINE_STACK_OF(BY_DIR_ENTRY)
  143.   typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY;
  144.   DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY)

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

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

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

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

crypto/x509/x509_lcl.h:142:1: return from a call to sk_BY_DIR_ENTRY_num
  140.   typedef struct lookup_dir_entry_st BY_DIR_ENTRY;
  141.   DEFINE_STACK_OF(BY_DIR_HASH)
  142. > DEFINE_STACK_OF(BY_DIR_ENTRY)
  143.   typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY;
  144.   DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY)

crypto/x509/by_dir.c:174:25: Loop condition is false. Leaving loop
172.               if (len == 0)
173.                   continue;
174.               for (j = 0; j < sk_BY_DIR_ENTRY_num(ctx->dirs); j++) {
                               ^
175.                   ent = sk_BY_DIR_ENTRY_value(ctx->dirs, j);
176.                   if (strlen(ent->dir) == len &&

crypto/x509/by_dir.c:180:17: 
178.                       break;
179.               }
180. >             if (j < sk_BY_DIR_ENTRY_num(ctx->dirs))
181.                   continue;
182.               if (ctx->dirs == NULL) {

crypto/x509/x509_lcl.h:142:1: start of procedure sk_BY_DIR_ENTRY_num()
  140.   typedef struct lookup_dir_entry_st BY_DIR_ENTRY;
  141.   DEFINE_STACK_OF(BY_DIR_HASH)
  142. > DEFINE_STACK_OF(BY_DIR_ENTRY)
  143.   typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY;
  144.   DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY)

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

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

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

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

crypto/x509/x509_lcl.h:142:1: return from a call to sk_BY_DIR_ENTRY_num
  140.   typedef struct lookup_dir_entry_st BY_DIR_ENTRY;
  141.   DEFINE_STACK_OF(BY_DIR_HASH)
  142. > DEFINE_STACK_OF(BY_DIR_ENTRY)
  143.   typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY;
  144.   DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY)

crypto/x509/by_dir.c:180:17: Taking false branch
178.                       break;
179.               }
180.               if (j < sk_BY_DIR_ENTRY_num(ctx->dirs))
                       ^
181.                   continue;
182.               if (ctx->dirs == NULL) {

crypto/x509/by_dir.c:182:17: Taking true branch
180.               if (j < sk_BY_DIR_ENTRY_num(ctx->dirs))
181.                   continue;
182.               if (ctx->dirs == NULL) {
                       ^
183.                   ctx->dirs = sk_BY_DIR_ENTRY_new_null();
184.                   if (!ctx->dirs) {

crypto/x509/by_dir.c:183:17: 
181.                   continue;
182.               if (ctx->dirs == NULL) {
183. >                 ctx->dirs = sk_BY_DIR_ENTRY_new_null();
184.                   if (!ctx->dirs) {
185.                       X509err(X509_F_ADD_CERT_DIR, ERR_R_MALLOC_FAILURE);

crypto/x509/x509_lcl.h:142:1: start of procedure sk_BY_DIR_ENTRY_new_null()
  140.   typedef struct lookup_dir_entry_st BY_DIR_ENTRY;
  141.   DEFINE_STACK_OF(BY_DIR_HASH)
  142. > DEFINE_STACK_OF(BY_DIR_ENTRY)
  143.   typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY;
  144.   DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY)

crypto/stack/stack.c:99:1: start of procedure OPENSSL_sk_new_null()
    97.   }
    98.   
    99. > OPENSSL_STACK *OPENSSL_sk_new_null(void)
    100.   {
    101.       return OPENSSL_sk_new((OPENSSL_sk_compfunc)NULL);

crypto/stack/stack.c:101:5: Skipping OPENSSL_sk_new(): empty list of specs
    99.   OPENSSL_STACK *OPENSSL_sk_new_null(void)
    100.   {
    101.       return OPENSSL_sk_new((OPENSSL_sk_compfunc)NULL);
               ^
    102.   }
    103.   

crypto/stack/stack.c:102:1: return from a call to OPENSSL_sk_new_null
    100.   {
    101.       return OPENSSL_sk_new((OPENSSL_sk_compfunc)NULL);
    102. > }
    103.   
    104.   OPENSSL_STACK *OPENSSL_sk_new(OPENSSL_sk_compfunc c)

crypto/x509/x509_lcl.h:142:1: return from a call to sk_BY_DIR_ENTRY_new_null
  140.   typedef struct lookup_dir_entry_st BY_DIR_ENTRY;
  141.   DEFINE_STACK_OF(BY_DIR_HASH)
  142. > DEFINE_STACK_OF(BY_DIR_ENTRY)
  143.   typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY;
  144.   DEFINE_STACK_OF(STACK_OF_X509_NAME_ENTRY)

crypto/x509/by_dir.c:184:22: Taking false branch
182.               if (ctx->dirs == NULL) {
183.                   ctx->dirs = sk_BY_DIR_ENTRY_new_null();
184.                   if (!ctx->dirs) {
                            ^
185.                       X509err(X509_F_ADD_CERT_DIR, ERR_R_MALLOC_FAILURE);
186.                       return 0;

crypto/x509/by_dir.c:189:13: 
187.                   }
188.               }
189. >             ent = OPENSSL_malloc(sizeof(*ent));
190.               if (ent == NULL)
191.                   return 0;

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

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

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

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

crypto/mem.c:162:9: Skipping __function_pointer__(): unresolved function pointer
  160.   
  161.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
  162.           return malloc_impl(num, file, line);
                 ^
  163.   
  164.       if (num <= 0)

crypto/mem.c:183:1: return from a call to CRYPTO_malloc
  181.   
  182.       return ret;
  183. > }
  184.   
  185.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/x509/by_dir.c:190:17: Taking false branch
188.               }
189.               ent = OPENSSL_malloc(sizeof(*ent));
190.               if (ent == NULL)
                       ^
191.                   return 0;
192.               ent->dir_type = type;

crypto/x509/by_dir.c:192:13: 
190.               if (ent == NULL)
191.                   return 0;
192. >             ent->dir_type = type;
193.               ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp);
194.               ent->dir = OPENSSL_strndup(ss, len);

crypto/x509/by_dir.c:193:13: 
191.                   return 0;
192.               ent->dir_type = type;
193. >             ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp);
194.               ent->dir = OPENSSL_strndup(ss, len);
195.               if (ent->dir == NULL || ent->hashes == NULL) {

crypto/x509/x509_lcl.h:141:1: start of procedure sk_BY_DIR_HASH_new()
  139.   typedef struct lookup_dir_hashes_st BY_DIR_HASH;
  140.   typedef struct lookup_dir_entry_st BY_DIR_ENTRY;
  141. > DEFINE_STACK_OF(BY_DIR_HASH)
  142.   DEFINE_STACK_OF(BY_DIR_ENTRY)
  143.   typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY;

crypto/x509/x509_lcl.h:141:1: return from a call to sk_BY_DIR_HASH_new
  139.   typedef struct lookup_dir_hashes_st BY_DIR_HASH;
  140.   typedef struct lookup_dir_entry_st BY_DIR_ENTRY;
  141. > DEFINE_STACK_OF(BY_DIR_HASH)
  142.   DEFINE_STACK_OF(BY_DIR_ENTRY)
  143.   typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY;

crypto/x509/by_dir.c:194:13: 
192.               ent->dir_type = type;
193.               ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp);
194. >             ent->dir = OPENSSL_strndup(ss, len);
195.               if (ent->dir == NULL || ent->hashes == NULL) {
196.                   by_dir_entry_free(ent);

crypto/o_str.c:42:1: start of procedure CRYPTO_strndup()
  40.   }
  41.   
  42. > char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line)
  43.   {
  44.       size_t maxlen;

crypto/o_str.c:47:9: Taking false branch
  45.       char *ret;
  46.   
  47.       if (str == NULL)
                ^
  48.           return NULL;
  49.   

crypto/o_str.c:50:5: 
  48.           return NULL;
  49.   
  50. >     maxlen = OPENSSL_strnlen(str, s);
  51.   
  52.       ret = CRYPTO_malloc(maxlen + 1, file, line);

crypto/o_str.c:75:1: start of procedure OPENSSL_strnlen()
    73.   }
    74.   
    75. > size_t OPENSSL_strnlen(const char *str, size_t maxlen)
    76.   {
    77.       const char *p;

crypto/o_str.c:79:10: 
    77.       const char *p;
    78.   
    79. >     for (p = str; maxlen-- != 0 && *p != '\0'; ++p) ;
    80.   
    81.       return p - str;

crypto/o_str.c:79:19: Loop condition is true. Entering loop body
    77.       const char *p;
    78.   
    79.       for (p = str; maxlen-- != 0 && *p != '\0'; ++p) ;
                            ^
    80.   
    81.       return p - str;

crypto/o_str.c:79:36: Loop condition is true. Entering loop body
    77.       const char *p;
    78.   
    79.       for (p = str; maxlen-- != 0 && *p != '\0'; ++p) ;
                                             ^
    80.   
    81.       return p - str;

crypto/o_str.c:79:48: 
    77.       const char *p;
    78.   
    79. >     for (p = str; maxlen-- != 0 && *p != '\0'; ++p) ;
    80.   
    81.       return p - str;

crypto/o_str.c:79:19: Loop condition is true. Entering loop body
    77.       const char *p;
    78.   
    79.       for (p = str; maxlen-- != 0 && *p != '\0'; ++p) ;
                            ^
    80.   
    81.       return p - str;

crypto/o_str.c:79:36: Loop condition is false. Leaving loop
    77.       const char *p;
    78.   
    79.       for (p = str; maxlen-- != 0 && *p != '\0'; ++p) ;
                                             ^
    80.   
    81.       return p - str;

crypto/o_str.c:81:5: 
    79.       for (p = str; maxlen-- != 0 && *p != '\0'; ++p) ;
    80.   
    81. >     return p - str;
    82.   }
    83.   

crypto/o_str.c:82:1: return from a call to OPENSSL_strnlen
    80.   
    81.       return p - str;
    82. > }
    83.   
    84.   size_t OPENSSL_strlcpy(char *dst, const char *src, size_t size)

crypto/o_str.c:52:5: 
  50.       maxlen = OPENSSL_strnlen(str, s);
  51.   
  52. >     ret = CRYPTO_malloc(maxlen + 1, file, line);
  53.       if (ret) {
  54.           memcpy(ret, str, maxlen);

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

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

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

crypto/mem.c:164:9: Taking false branch
    162.           return malloc_impl(num, file, line);
    163.   
    164.       if (num <= 0)
                   ^
    165.           return NULL;
    166.   

crypto/mem.c:168:5: 
    166.   
    167.       FAILTEST();
    168. >     allow_customize = 0;
    169.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
    170.       if (call_malloc_debug) {

crypto/mem.c:178:5: 
    176.       }
    177.   #else
    178. >     osslargused(file); osslargused(line);
    179.       ret = malloc(num);
    180.   #endif

crypto/mem.c:178:24: 
    176.       }
    177.   #else
    178. >     osslargused(file); osslargused(line);
    179.       ret = malloc(num);
    180.   #endif

crypto/mem.c:179:5: 
    177.   #else
    178.       osslargused(file); osslargused(line);
    179. >     ret = malloc(num);
    180.   #endif
    181.   

crypto/mem.c:182:5: 
    180.   #endif
    181.   
    182. >     return ret;
    183.   }
    184.   

crypto/mem.c:183:1: return from a call to CRYPTO_malloc
    181.   
    182.       return ret;
    183. > }
    184.   
    185.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/o_str.c:53:9: Taking true branch
  51.   
  52.       ret = CRYPTO_malloc(maxlen + 1, file, line);
  53.       if (ret) {
                ^
  54.           memcpy(ret, str, maxlen);
  55.           ret[maxlen] = '\0';

crypto/o_str.c:54:9: 
  52.       ret = CRYPTO_malloc(maxlen + 1, file, line);
  53.       if (ret) {
  54. >         memcpy(ret, str, maxlen);
  55.           ret[maxlen] = '\0';
  56.       }

crypto/o_str.c:55:9: 
  53.       if (ret) {
  54.           memcpy(ret, str, maxlen);
  55. >         ret[maxlen] = '\0';
  56.       }
  57.       return ret;

crypto/o_str.c:57:5: 
  55.           ret[maxlen] = '\0';
  56.       }
  57. >     return ret;
  58.   }
  59.   

crypto/o_str.c:58:1: return from a call to CRYPTO_strndup
  56.       }
  57.       return ret;
  58. > }
  59.   
  60.   void *CRYPTO_memdup(const void *data, size_t siz, const char* file, int line)

crypto/x509/by_dir.c:195:17: Taking false branch
193.               ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp);
194.               ent->dir = OPENSSL_strndup(ss, len);
195.               if (ent->dir == NULL || ent->hashes == NULL) {
                       ^
196.                   by_dir_entry_free(ent);
197.                   return 0;

crypto/x509/by_dir.c:195:37: Taking true branch
193.               ent->hashes = sk_BY_DIR_HASH_new(by_dir_hash_cmp);
194.               ent->dir = OPENSSL_strndup(ss, len);
195.               if (ent->dir == NULL || ent->hashes == NULL) {
                                           ^
196.                   by_dir_entry_free(ent);
197.                   return 0;

crypto/x509/by_dir.c:196:17: 
194.               ent->dir = OPENSSL_strndup(ss, len);
195.               if (ent->dir == NULL || ent->hashes == NULL) {
196. >                 by_dir_entry_free(ent);
197.                   return 0;
198.               }

crypto/x509/by_dir.c:135:1: start of procedure by_dir_entry_free()
  133.   }
  134.   
  135. > static void by_dir_entry_free(BY_DIR_ENTRY *ent)
  136.   {
  137.       OPENSSL_free(ent->dir);

crypto/x509/by_dir.c:137:5: 
  135.   static void by_dir_entry_free(BY_DIR_ENTRY *ent)
  136.   {
  137. >     OPENSSL_free(ent->dir);
  138.       sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free);
  139.       OPENSSL_free(ent);

crypto/mem.c:252:1: start of procedure CRYPTO_free()
    250.   }
    251.   
    252. > void CRYPTO_free(void *str, const char *file, int line)
    253.   {
    254.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:254:9: Taking true branch
    252.   void CRYPTO_free(void *str, const char *file, int line)
    253.   {
    254.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    255.           free_impl(str, file, line);
    256.           return;

crypto/mem.c:254:30: Taking true branch
    252.   void CRYPTO_free(void *str, const char *file, int line)
    253.   {
    254.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    255.           free_impl(str, file, line);
    256.           return;

crypto/mem.c:255:9: Skipping __function_pointer__(): unresolved function pointer
    253.   {
    254.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    255.           free_impl(str, file, line);
                   ^
    256.           return;
    257.       }

crypto/mem.c:256:9: 
    254.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    255.           free_impl(str, file, line);
    256. >         return;
    257.       }
    258.   

crypto/mem.c:270:1: return from a call to CRYPTO_free
    268.       free(str);
    269.   #endif
    270. > }
    271.   
    272.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/x509/by_dir.c:138:5: 
  136.   {
  137.       OPENSSL_free(ent->dir);
  138. >     sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free);
  139.       OPENSSL_free(ent);
  140.   }

crypto/x509/x509_lcl.h:141:1: start of procedure sk_BY_DIR_HASH_pop_free()
    139.   typedef struct lookup_dir_hashes_st BY_DIR_HASH;
    140.   typedef struct lookup_dir_entry_st BY_DIR_ENTRY;
    141. > DEFINE_STACK_OF(BY_DIR_HASH)
    142.   DEFINE_STACK_OF(BY_DIR_ENTRY)
    143.   typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY;

crypto/x509/x509_lcl.h:141:1: return from a call to sk_BY_DIR_HASH_pop_free
    139.   typedef struct lookup_dir_hashes_st BY_DIR_HASH;
    140.   typedef struct lookup_dir_entry_st BY_DIR_ENTRY;
    141. > DEFINE_STACK_OF(BY_DIR_HASH)
    142.   DEFINE_STACK_OF(BY_DIR_ENTRY)
    143.   typedef STACK_OF(X509_NAME_ENTRY) STACK_OF_X509_NAME_ENTRY;

crypto/x509/by_dir.c:139:5: 
  137.       OPENSSL_free(ent->dir);
  138.       sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free);
  139. >     OPENSSL_free(ent);
  140.   }
  141.   

crypto/mem.c:252:1: start of procedure CRYPTO_free()
    250.   }
    251.   
    252. > void CRYPTO_free(void *str, const char *file, int line)
    253.   {
    254.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:254:9: Taking false branch
    252.   void CRYPTO_free(void *str, const char *file, int line)
    253.   {
    254.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    255.           free_impl(str, file, line);
    256.           return;

crypto/mem.c:268:5: 
    266.       }
    267.   #else
    268. >     free(str);
    269.   #endif
    270.   }

crypto/mem.c:270:1: return from a call to CRYPTO_free
    268.       free(str);
    269.   #endif
    270. > }
    271.   
    272.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/x509/by_dir.c:140:1: return from a call to by_dir_entry_free
  138.       sk_BY_DIR_HASH_pop_free(ent->hashes, by_dir_hash_free);
  139.       OPENSSL_free(ent);
  140. > }
  141.   
  142.   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 OPENSSL_sk_num(const OPENSSL_STACK *st)\n{\n    if (st == NULL)\n        return -1;\n    return st->num;\n}', 'OPENSSL_STACK *OPENSSL_sk_new_null(void)\n{\n    return OPENSSL_sk_new((OPENSSL_sk_compfunc)NULL);\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    FAILTEST();\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}']