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


crypto/ct/ct_log.c:251:1: start of procedure CTLOG_new()
249.    * Copies the name.
250.    */
251. > CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name)
252.   {
253.       CTLOG *ret = CTLOG_new_null();

crypto/ct/ct_log.c:253:5: 
251.   CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name)
252.   {
253. >     CTLOG *ret = CTLOG_new_null();
254.   
255.       if (ret == NULL)

crypto/ct/ct_log.c:272:1: start of procedure CTLOG_new_null()
  270.   }
  271.   
  272. > CTLOG *CTLOG_new_null(void)
  273.   {
  274.       CTLOG *ret = OPENSSL_zalloc(sizeof(*ret));

crypto/ct/ct_log.c:274:5: 
  272.   CTLOG *CTLOG_new_null(void)
  273.   {
  274. >     CTLOG *ret = OPENSSL_zalloc(sizeof(*ret));
  275.   
  276.       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:276:9: Taking false branch
  274.       CTLOG *ret = OPENSSL_zalloc(sizeof(*ret));
  275.   
  276.       if (ret == NULL)
                 ^
  277.           CTerr(CT_F_CTLOG_NEW_NULL, ERR_R_MALLOC_FAILURE);
  278.   

crypto/ct/ct_log.c:279:5: 
  277.           CTerr(CT_F_CTLOG_NEW_NULL, ERR_R_MALLOC_FAILURE);
  278.   
  279. >     return ret;
  280.   }
  281.   

crypto/ct/ct_log.c:280:1: return from a call to CTLOG_new_null
  278.   
  279.       return ret;
  280. > }
  281.   
  282.   /* Frees CT log and associated structures */

crypto/ct/ct_log.c:255:9: Taking false branch
253.       CTLOG *ret = CTLOG_new_null();
254.   
255.       if (ret == NULL)
               ^
256.           goto err;
257.   

crypto/ct/ct_log.c:258:5: 
256.           goto err;
257.   
258. >     ret->name = OPENSSL_strdup(name);
259.       if (ret->name == NULL)
260.           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:259:9: Taking false branch
257.   
258.       ret->name = OPENSSL_strdup(name);
259.       if (ret->name == NULL)
               ^
260.           goto err;
261.   

crypto/ct/ct_log.c:262:5: 
260.           goto err;
261.   
262. >     ret->public_key = public_key;
263.       if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1)
264.           goto err;

crypto/ct/ct_log.c:263:9: 
261.   
262.       ret->public_key = public_key;
263. >     if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1)
264.           goto err;
265.   

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

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

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

crypto/ct/ct_log.c:128:5: 
  126.       int ret = 0;
  127.       unsigned char *pkey_der = NULL;
  128. >     int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der);
  129.   
  130.       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:130:9: Taking true branch
  128.       int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der);
  129.   
  130.       if (pkey_der_len <= 0) {
                 ^
  131.           CTerr(CT_F_CT_V1_LOG_ID_FROM_PKEY, CT_R_LOG_KEY_INVALID);
  132.           goto err;

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

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

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

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

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

crypto/ct/ct_log.c:263:9: Taking true branch
261.   
262.       ret->public_key = public_key;
263.       if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1)
               ^
264.           goto err;
265.   

crypto/ct/ct_log.c:267:1: 
265.   
266.       return ret;
267. > err:
268.       CTLOG_free(ret);
269.       return NULL;

crypto/ct/ct_log.c:268:5: 
266.       return ret;
267.   err:
268. >     CTLOG_free(ret);
269.       return NULL;
270.   }

crypto/ct/ct_log.c:283:1: start of procedure CTLOG_free()
  281.   
  282.   /* Frees CT log and associated structures */
  283. > void CTLOG_free(CTLOG *log)
  284.   {
  285.       if (log != NULL) {

crypto/ct/ct_log.c:285:9: Taking true branch
  283.   void CTLOG_free(CTLOG *log)
  284.   {
  285.       if (log != NULL) {
                 ^
  286.           OPENSSL_free(log->name);
  287.           EVP_PKEY_free(log->public_key);

crypto/ct/ct_log.c:286:9: 
  284.   {
  285.       if (log != NULL) {
  286. >         OPENSSL_free(log->name);
  287.           EVP_PKEY_free(log->public_key);
  288.           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:287:9: 
  285.       if (log != NULL) {
  286.           OPENSSL_free(log->name);
  287. >         EVP_PKEY_free(log->public_key);
  288.           OPENSSL_free(log);
  289.       }

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:288:9: 
  286.           OPENSSL_free(log->name);
  287.           EVP_PKEY_free(log->public_key);
  288. >         OPENSSL_free(log);
  289.       }
  290.   }

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:285:5: 
  283.   void CTLOG_free(CTLOG *log)
  284.   {
  285. >     if (log != NULL) {
  286.           OPENSSL_free(log->name);
  287.           EVP_PKEY_free(log->public_key);

crypto/ct/ct_log.c:290:1: return from a call to CTLOG_free
  288.           OPENSSL_free(log);
  289.       }
  290. > }
  291.   
  292.   const char *CTLOG_get0_name(CTLOG *log)
