crypto/ct/ct_log.c:294: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_strdup()` at line 284, column 17 is not reachable after line 294, column 5.
Showing all 89 steps of the trace


crypto/ct/ct_log.c:277:1: start of procedure CTLOG_new()
275.    * Copies the name.
276.    */
277. > CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name)
278.   {
279.       CTLOG *ret = CTLOG_new_null();

crypto/ct/ct_log.c:279:5: 
277.   CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name)
278.   {
279. >     CTLOG *ret = CTLOG_new_null();
280.   
281.       if (ret == NULL)

crypto/ct/ct_log.c:298:1: start of procedure CTLOG_new_null()
  296.   }
  297.   
  298. > CTLOG *CTLOG_new_null(void)
  299.   {
  300.       CTLOG *ret = OPENSSL_zalloc(sizeof(*ret));

crypto/ct/ct_log.c:300:5: 
  298.   CTLOG *CTLOG_new_null(void)
  299.   {
  300. >     CTLOG *ret = OPENSSL_zalloc(sizeof(*ret));
  301.   
  302.       if (ret == NULL)

crypto/mem.c:146:1: start of procedure CRYPTO_zalloc()
    144.   }
    145.   
    146. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    147.   {
    148.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:148:5: 
    146.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    147.   {
    148. >     void *ret = CRYPTO_malloc(num, file, line);
    149.   
    150.       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 (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/mem.c:150:9: Taking true branch
    148.       void *ret = CRYPTO_malloc(num, file, line);
    149.   
    150.       if (ret != NULL)
                   ^
    151.           memset(ret, 0, num);
    152.       return ret;

crypto/mem.c:151:9: 
    149.   
    150.       if (ret != NULL)
    151. >         memset(ret, 0, num);
    152.       return ret;
    153.   }

crypto/mem.c:152:5: 
    150.       if (ret != NULL)
    151.           memset(ret, 0, num);
    152. >     return ret;
    153.   }
    154.   

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

crypto/ct/ct_log.c:302:9: Taking false branch
  300.       CTLOG *ret = OPENSSL_zalloc(sizeof(*ret));
  301.   
  302.       if (ret == NULL)
                 ^
  303.           CTerr(CT_F_CTLOG_NEW_NULL, ERR_R_MALLOC_FAILURE);
  304.   

crypto/ct/ct_log.c:305:5: 
  303.           CTerr(CT_F_CTLOG_NEW_NULL, ERR_R_MALLOC_FAILURE);
  304.   
  305. >     return ret;
  306.   }
  307.   

crypto/ct/ct_log.c:306:1: return from a call to CTLOG_new_null
  304.   
  305.       return ret;
  306. > }
  307.   
  308.   /* Frees CT log and associated structures */

crypto/ct/ct_log.c:281:9: Taking false branch
279.       CTLOG *ret = CTLOG_new_null();
280.   
281.       if (ret == NULL)
               ^
282.           goto err;
283.   

crypto/ct/ct_log.c:284:5: 
282.           goto err;
283.   
284. >     ret->name = OPENSSL_strdup(name);
285.       if (ret->name == NULL)
286.           goto err;

crypto/o_str.c:120:1: start of procedure CRYPTO_strdup()
  118.   }
  119.   
  120. > char *CRYPTO_strdup(const char *str, const char* file, int line)
  121.   {
  122.       char *ret;

crypto/o_str.c:125:9: Taking false branch
  123.       size_t size;
  124.   
  125.       if (str == NULL)
                 ^
  126.           return NULL;
  127.       size = strlen(str) + 1;

crypto/o_str.c:127:5: 
  125.       if (str == NULL)
  126.           return NULL;
  127. >     size = strlen(str) + 1;
  128.       ret = CRYPTO_malloc(size, file, line);
  129.       if (ret != NULL)

crypto/o_str.c:128:5: 
  126.           return NULL;
  127.       size = strlen(str) + 1;
  128. >     ret = CRYPTO_malloc(size, file, line);
  129.       if (ret != NULL)
  130.           memcpy(ret, str, size);

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:129:9: Taking true branch
  127.       size = strlen(str) + 1;
  128.       ret = CRYPTO_malloc(size, file, line);
  129.       if (ret != NULL)
                 ^
  130.           memcpy(ret, str, size);
  131.       return ret;

crypto/o_str.c:130:9: 
  128.       ret = CRYPTO_malloc(size, file, line);
  129.       if (ret != NULL)
  130. >         memcpy(ret, str, size);
  131.       return ret;
  132.   }

crypto/o_str.c:131:5: 
  129.       if (ret != NULL)
  130.           memcpy(ret, str, size);
  131. >     return ret;
  132.   }
  133.   

crypto/o_str.c:132:1: return from a call to CRYPTO_strdup
  130.           memcpy(ret, str, size);
  131.       return ret;
  132. > }
  133.   
  134.   char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line)

crypto/ct/ct_log.c:285:9: Taking false branch
283.   
284.       ret->name = OPENSSL_strdup(name);
285.       if (ret->name == NULL)
               ^
286.           goto err;
287.   

crypto/ct/ct_log.c:288:5: 
286.           goto err;
287.   
288. >     ret->public_key = public_key;
289.       if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1)
290.           goto err;

crypto/ct/ct_log.c:289:9: 
287.   
288.       ret->public_key = public_key;
289. >     if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1)
290.           goto err;
291.   

crypto/ct/ct_log.c:124:1: start of procedure ct_v1_log_id_from_pkey()
  122.   
  123.   /* Converts a log's public key into a SHA256 log ID */
  124. > static int ct_v1_log_id_from_pkey(EVP_PKEY *pkey,
  125.                                     unsigned char log_id[CT_V1_HASHLEN])
  126.   {

crypto/ct/ct_log.c:127:5: 
  125.                                     unsigned char log_id[CT_V1_HASHLEN])
  126.   {
  127. >     int ret = 0;
  128.       unsigned char *pkey_der = NULL;
  129.       int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der);

crypto/ct/ct_log.c:128:5: 
  126.   {
  127.       int ret = 0;
  128. >     unsigned char *pkey_der = NULL;
  129.       int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der);
  130.   

crypto/ct/ct_log.c:129:5: 
  127.       int ret = 0;
  128.       unsigned char *pkey_der = NULL;
  129. >     int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der);
  130.   
  131.       if (pkey_der_len <= 0) {

crypto/asn1/x_pubkey.c:209:1: start of procedure i2d_PUBKEY()
    207.   }
    208.   
    209. > int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp)
    210.   {
    211.       X509_PUBKEY *xpk = NULL;

crypto/asn1/x_pubkey.c:211:5: 
    209.   int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp)
    210.   {
    211. >     X509_PUBKEY *xpk = NULL;
    212.       int ret;
    213.       if (!a)

crypto/asn1/x_pubkey.c:213:10: Taking true branch
    211.       X509_PUBKEY *xpk = NULL;
    212.       int ret;
    213.       if (!a)
                    ^
    214.           return 0;
    215.       if (!X509_PUBKEY_set(&xpk, a))

crypto/asn1/x_pubkey.c:214:9: 
    212.       int ret;
    213.       if (!a)
    214. >         return 0;
    215.       if (!X509_PUBKEY_set(&xpk, a))
    216.           return 0;

crypto/asn1/x_pubkey.c:220:1: return from a call to i2d_PUBKEY
    218.       X509_PUBKEY_free(xpk);
    219.       return ret;
    220. > }
    221.   
    222.   /*

crypto/ct/ct_log.c:131:9: Taking true branch
  129.       int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der);
  130.   
  131.       if (pkey_der_len <= 0) {
                 ^
  132.           CTerr(CT_F_CT_V1_LOG_ID_FROM_PKEY, CT_R_LOG_KEY_INVALID);
  133.           goto err;

crypto/ct/ct_log.c:132:9: Skipping ERR_put_error(): empty list of specs
  130.   
  131.       if (pkey_der_len <= 0) {
  132.           CTerr(CT_F_CT_V1_LOG_ID_FROM_PKEY, CT_R_LOG_KEY_INVALID);
                 ^
  133.           goto err;
  134.       }

crypto/ct/ct_log.c:138:1: 
  136.       SHA256(pkey_der, pkey_der_len, log_id);
  137.       ret = 1;
  138. > err:
  139.       OPENSSL_free(pkey_der);
  140.       return ret;

crypto/ct/ct_log.c:139:5: 
  137.       ret = 1;
  138.   err:
  139. >     OPENSSL_free(pkey_der);
  140.       return ret;
  141.   }

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/ct/ct_log.c:140:5: 
  138.   err:
  139.       OPENSSL_free(pkey_der);
  140. >     return ret;
  141.   }
  142.   

crypto/ct/ct_log.c:141:1: return from a call to ct_v1_log_id_from_pkey
  139.       OPENSSL_free(pkey_der);
  140.       return ret;
  141. > }
  142.   
  143.   CTLOG_STORE *CTLOG_STORE_new(void)

crypto/ct/ct_log.c:289:9: Taking true branch
287.   
288.       ret->public_key = public_key;
289.       if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1)
               ^
290.           goto err;
291.   

crypto/ct/ct_log.c:293:1: 
291.   
292.       return ret;
293. > err:
294.       CTLOG_free(ret);
295.       return NULL;

crypto/ct/ct_log.c:294:5: 
292.       return ret;
293.   err:
294. >     CTLOG_free(ret);
295.       return NULL;
296.   }

crypto/ct/ct_log.c:309:1: start of procedure CTLOG_free()
  307.   
  308.   /* Frees CT log and associated structures */
  309. > void CTLOG_free(CTLOG *log)
  310.   {
  311.       if (log != NULL) {

crypto/ct/ct_log.c:311:9: Taking true branch
  309.   void CTLOG_free(CTLOG *log)
  310.   {
  311.       if (log != NULL) {
                 ^
  312.           OPENSSL_free(log->name);
  313.           EVP_PKEY_free(log->public_key);

crypto/ct/ct_log.c:312:9: 
  310.   {
  311.       if (log != NULL) {
  312. >         OPENSSL_free(log->name);
  313.           EVP_PKEY_free(log->public_key);
  314.           OPENSSL_free(log);

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/ct/ct_log.c:313:9: 
  311.       if (log != NULL) {
  312.           OPENSSL_free(log->name);
  313. >         EVP_PKEY_free(log->public_key);
  314.           OPENSSL_free(log);
  315.       }

crypto/evp/p_lib.c:412:1: start of procedure EVP_PKEY_free()
    410.   }
    411.   
    412. > void EVP_PKEY_free(EVP_PKEY *x)
    413.   {
    414.       int i;

crypto/evp/p_lib.c:416:9: Taking true branch
    414.       int i;
    415.   
    416.       if (x == NULL)
                   ^
    417.           return;
    418.   

crypto/evp/p_lib.c:417:9: 
    415.   
    416.       if (x == NULL)
    417. >         return;
    418.   
    419.       i = CRYPTO_add(&x->references, -1, CRYPTO_LOCK_EVP_PKEY);

crypto/evp/p_lib.c:427:1: return from a call to EVP_PKEY_free
    425.       sk_X509_ATTRIBUTE_pop_free(x->attributes, X509_ATTRIBUTE_free);
    426.       OPENSSL_free(x);
    427. > }
    428.   
    429.   static void EVP_PKEY_free_it(EVP_PKEY *x)

crypto/ct/ct_log.c:314:9: 
  312.           OPENSSL_free(log->name);
  313.           EVP_PKEY_free(log->public_key);
  314. >         OPENSSL_free(log);
  315.       }
  316.   }

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/ct/ct_log.c:311:5: 
  309.   void CTLOG_free(CTLOG *log)
  310.   {
  311. >     if (log != NULL) {
  312.           OPENSSL_free(log->name);
  313.           EVP_PKEY_free(log->public_key);

crypto/ct/ct_log.c:316:1: return from a call to CTLOG_free
  314.           OPENSSL_free(log);
  315.       }
  316. > }
  317.   
  318.   const char *CTLOG_get0_name(CTLOG *log)
