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


crypto/ct/ct_log.c:237:1: start of procedure CTLOG_new()
235.    * Copies the name.
236.    */
237. > CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name)
238.   {
239.       CTLOG *ret = OPENSSL_zalloc(sizeof(*ret));

crypto/ct/ct_log.c:239:5: 
237.   CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name)
238.   {
239. >     CTLOG *ret = OPENSSL_zalloc(sizeof(*ret));
240.   
241.       if (ret == NULL) {

crypto/mem.c:198:1: start of procedure CRYPTO_zalloc()
  196.   }
  197.   
  198. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
  199.   {
  200.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:200:5: 
  198.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
  199.   {
  200. >     void *ret = CRYPTO_malloc(num, file, line);
  201.   
  202.       FAILTEST();

crypto/mem.c:170:1: start of procedure CRYPTO_malloc()
    168.   #endif
    169.   
    170. > void *CRYPTO_malloc(size_t num, const char *file, int line)
    171.   {
    172.       void *ret = NULL;

crypto/mem.c:172:5: 
    170.   void *CRYPTO_malloc(size_t num, const char *file, int line)
    171.   {
    172. >     void *ret = NULL;
    173.   
    174.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:174:9: Taking false branch
    172.       void *ret = NULL;
    173.   
    174.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                   ^
    175.           return malloc_impl(num, file, line);
    176.   

crypto/mem.c:177:9: Taking false branch
    175.           return malloc_impl(num, file, line);
    176.   
    177.       if (num == 0)
                   ^
    178.           return NULL;
    179.   

crypto/mem.c:181:5: 
    179.   
    180.       FAILTEST();
    181. >     allow_customize = 0;
    182.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
    183.       if (call_malloc_debug) {

crypto/mem.c:191:5: 
    189.       }
    190.   #else
    191. >     (void)(file); (void)(line);
    192.       ret = malloc(num);
    193.   #endif

crypto/mem.c:191:19: 
    189.       }
    190.   #else
    191. >     (void)(file); (void)(line);
    192.       ret = malloc(num);
    193.   #endif

crypto/mem.c:192:5: 
    190.   #else
    191.       (void)(file); (void)(line);
    192. >     ret = malloc(num);
    193.   #endif
    194.   

crypto/mem.c:195:5: 
    193.   #endif
    194.   
    195. >     return ret;
    196.   }
    197.   

crypto/mem.c:196:1: return from a call to CRYPTO_malloc
    194.   
    195.       return ret;
    196. > }
    197.   
    198.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:203:9: Taking true branch
  201.   
  202.       FAILTEST();
  203.       if (ret != NULL)
                 ^
  204.           memset(ret, 0, num);
  205.       return ret;

crypto/mem.c:204:9: 
  202.       FAILTEST();
  203.       if (ret != NULL)
  204. >         memset(ret, 0, num);
  205.       return ret;
  206.   }

crypto/mem.c:205:5: 
  203.       if (ret != NULL)
  204.           memset(ret, 0, num);
  205. >     return ret;
  206.   }
  207.   

crypto/mem.c:206:1: return from a call to CRYPTO_zalloc
  204.           memset(ret, 0, num);
  205.       return ret;
  206. > }
  207.   
  208.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/ct/ct_log.c:241:9: Taking false branch
239.       CTLOG *ret = OPENSSL_zalloc(sizeof(*ret));
240.   
241.       if (ret == NULL) {
               ^
242.           CTerr(CT_F_CTLOG_NEW, ERR_R_MALLOC_FAILURE);
243.           return NULL;

crypto/ct/ct_log.c:246:5: 
244.       }
245.   
246. >     ret->name = OPENSSL_strdup(name);
247.       if (ret->name == NULL) {
248.           CTerr(CT_F_CTLOG_NEW, ERR_R_MALLOC_FAILURE);

crypto/o_str.c:27:1: start of procedure CRYPTO_strdup()
  25.   }
  26.   
  27. > char *CRYPTO_strdup(const char *str, const char* file, int line)
  28.   {
  29.       char *ret;

crypto/o_str.c:32:9: Taking false branch
  30.       size_t size;
  31.   
  32.       if (str == NULL)
                ^
  33.           return NULL;
  34.       size = strlen(str) + 1;

crypto/o_str.c:34:5: 
  32.       if (str == NULL)
  33.           return NULL;
  34. >     size = strlen(str) + 1;
  35.       ret = CRYPTO_malloc(size, file, line);
  36.       if (ret != NULL)

crypto/o_str.c:35:5: 
  33.           return NULL;
  34.       size = strlen(str) + 1;
  35. >     ret = CRYPTO_malloc(size, file, line);
  36.       if (ret != NULL)
  37.           memcpy(ret, str, size);

crypto/mem.c:170:1: start of procedure CRYPTO_malloc()
    168.   #endif
    169.   
    170. > void *CRYPTO_malloc(size_t num, const char *file, int line)
    171.   {
    172.       void *ret = NULL;

crypto/mem.c:172:5: 
    170.   void *CRYPTO_malloc(size_t num, const char *file, int line)
    171.   {
    172. >     void *ret = NULL;
    173.   
    174.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:174:9: Taking false branch
    172.       void *ret = NULL;
    173.   
    174.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                   ^
    175.           return malloc_impl(num, file, line);
    176.   

crypto/mem.c:177:9: Taking false branch
    175.           return malloc_impl(num, file, line);
    176.   
    177.       if (num == 0)
                   ^
    178.           return NULL;
    179.   

crypto/mem.c:181:5: 
    179.   
    180.       FAILTEST();
    181. >     allow_customize = 0;
    182.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
    183.       if (call_malloc_debug) {

crypto/mem.c:191:5: 
    189.       }
    190.   #else
    191. >     (void)(file); (void)(line);
    192.       ret = malloc(num);
    193.   #endif

crypto/mem.c:191:19: 
    189.       }
    190.   #else
    191. >     (void)(file); (void)(line);
    192.       ret = malloc(num);
    193.   #endif

crypto/mem.c:192:5: 
    190.   #else
    191.       (void)(file); (void)(line);
    192. >     ret = malloc(num);
    193.   #endif
    194.   

crypto/mem.c:195:5: 
    193.   #endif
    194.   
    195. >     return ret;
    196.   }
    197.   

crypto/mem.c:196:1: return from a call to CRYPTO_malloc
    194.   
    195.       return ret;
    196. > }
    197.   
    198.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/o_str.c:36:9: Taking true branch
  34.       size = strlen(str) + 1;
  35.       ret = CRYPTO_malloc(size, file, line);
  36.       if (ret != NULL)
                ^
  37.           memcpy(ret, str, size);
  38.       return ret;

crypto/o_str.c:37:9: 
  35.       ret = CRYPTO_malloc(size, file, line);
  36.       if (ret != NULL)
  37. >         memcpy(ret, str, size);
  38.       return ret;
  39.   }

crypto/o_str.c:38:5: 
  36.       if (ret != NULL)
  37.           memcpy(ret, str, size);
  38. >     return ret;
  39.   }
  40.   

crypto/o_str.c:39:1: return from a call to CRYPTO_strdup
  37.           memcpy(ret, str, size);
  38.       return ret;
  39. > }
  40.   
  41.   char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line)

crypto/ct/ct_log.c:247:9: Taking false branch
245.   
246.       ret->name = OPENSSL_strdup(name);
247.       if (ret->name == NULL) {
               ^
248.           CTerr(CT_F_CTLOG_NEW, ERR_R_MALLOC_FAILURE);
249.           goto err;

crypto/ct/ct_log.c:252:9: 
250.       }
251.   
252. >     if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1)
253.           goto err;
254.   

crypto/ct/ct_log.c:73:1: start of procedure ct_v1_log_id_from_pkey()
  71.   
  72.   /* Converts a log's public key into a SHA256 log ID */
  73. > static int ct_v1_log_id_from_pkey(EVP_PKEY *pkey,
  74.                                     unsigned char log_id[CT_V1_HASHLEN])
  75.   {

crypto/ct/ct_log.c:76:5: 
  74.                                     unsigned char log_id[CT_V1_HASHLEN])
  75.   {
  76. >     int ret = 0;
  77.       unsigned char *pkey_der = NULL;
  78.       int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der);

crypto/ct/ct_log.c:77:5: 
  75.   {
  76.       int ret = 0;
  77. >     unsigned char *pkey_der = NULL;
  78.       int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der);
  79.   

crypto/ct/ct_log.c:78:5: 
  76.       int ret = 0;
  77.       unsigned char *pkey_der = NULL;
  78. >     int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der);
  79.   
  80.       if (pkey_der_len <= 0) {

crypto/x509/x_pubkey.c:202:1: start of procedure i2d_PUBKEY()
    200.   }
    201.   
    202. > int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp)
    203.   {
    204.       X509_PUBKEY *xpk = NULL;

crypto/x509/x_pubkey.c:204:5: 
    202.   int i2d_PUBKEY(EVP_PKEY *a, unsigned char **pp)
    203.   {
    204. >     X509_PUBKEY *xpk = NULL;
    205.       int ret;
    206.       if (!a)

crypto/x509/x_pubkey.c:206:10: Taking true branch
    204.       X509_PUBKEY *xpk = NULL;
    205.       int ret;
    206.       if (!a)
                    ^
    207.           return 0;
    208.       if (!X509_PUBKEY_set(&xpk, a))

crypto/x509/x_pubkey.c:207:9: 
    205.       int ret;
    206.       if (!a)
    207. >         return 0;
    208.       if (!X509_PUBKEY_set(&xpk, a))
    209.           return 0;

crypto/x509/x_pubkey.c:213:1: return from a call to i2d_PUBKEY
    211.       X509_PUBKEY_free(xpk);
    212.       return ret;
    213. > }
    214.   
    215.   /*

crypto/ct/ct_log.c:80:9: Taking true branch
  78.       int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der);
  79.   
  80.       if (pkey_der_len <= 0) {
                ^
  81.           CTerr(CT_F_CT_V1_LOG_ID_FROM_PKEY, CT_R_LOG_KEY_INVALID);
  82.           goto err;

crypto/ct/ct_log.c:81:9: Skipping ERR_put_error(): empty list of specs
  79.   
  80.       if (pkey_der_len <= 0) {
  81.           CTerr(CT_F_CT_V1_LOG_ID_FROM_PKEY, CT_R_LOG_KEY_INVALID);
                ^
  82.           goto err;
  83.       }

crypto/ct/ct_log.c:87:1: 
  85.       SHA256(pkey_der, pkey_der_len, log_id);
  86.       ret = 1;
  87. > err:
  88.       OPENSSL_free(pkey_der);
  89.       return ret;

crypto/ct/ct_log.c:88:5: 
  86.       ret = 1;
  87.   err:
  88. >     OPENSSL_free(pkey_der);
  89.       return ret;
  90.   }

crypto/mem.c:265:1: start of procedure CRYPTO_free()
    263.   }
    264.   
    265. > void CRYPTO_free(void *str, const char *file, int line)
    266.   {
    267.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:267:9: Taking false branch
    265.   void CRYPTO_free(void *str, const char *file, int line)
    266.   {
    267.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    268.           free_impl(str, file, line);
    269.           return;

crypto/mem.c:281:5: 
    279.       }
    280.   #else
    281. >     free(str);
    282.   #endif
    283.   }

crypto/mem.c:283:1: return from a call to CRYPTO_free
    281.       free(str);
    282.   #endif
    283. > }
    284.   
    285.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/ct/ct_log.c:89:5: 
  87.   err:
  88.       OPENSSL_free(pkey_der);
  89. >     return ret;
  90.   }
  91.   

crypto/ct/ct_log.c:90:1: return from a call to ct_v1_log_id_from_pkey
  88.       OPENSSL_free(pkey_der);
  89.       return ret;
  90. > }
  91.   
  92.   CTLOG_STORE *CTLOG_STORE_new(void)

crypto/ct/ct_log.c:252:9: Taking true branch
250.       }
251.   
252.       if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1)
               ^
253.           goto err;
254.   

crypto/ct/ct_log.c:257:1: 
255.       ret->public_key = public_key;
256.       return ret;
257. > err:
258.       CTLOG_free(ret);
259.       return NULL;

crypto/ct/ct_log.c:258:5: 
256.       return ret;
257.   err:
258. >     CTLOG_free(ret);
259.       return NULL;
260.   }

crypto/ct/ct_log.c:263:1: start of procedure CTLOG_free()
  261.   
  262.   /* Frees CT log and associated structures */
  263. > void CTLOG_free(CTLOG *log)
  264.   {
  265.       if (log != NULL) {

crypto/ct/ct_log.c:265:9: Taking true branch
  263.   void CTLOG_free(CTLOG *log)
  264.   {
  265.       if (log != NULL) {
                 ^
  266.           OPENSSL_free(log->name);
  267.           EVP_PKEY_free(log->public_key);

crypto/ct/ct_log.c:266:9: 
  264.   {
  265.       if (log != NULL) {
  266. >         OPENSSL_free(log->name);
  267.           EVP_PKEY_free(log->public_key);
  268.           OPENSSL_free(log);

crypto/mem.c:265:1: start of procedure CRYPTO_free()
    263.   }
    264.   
    265. > void CRYPTO_free(void *str, const char *file, int line)
    266.   {
    267.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:267:9: Taking true branch
    265.   void CRYPTO_free(void *str, const char *file, int line)
    266.   {
    267.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    268.           free_impl(str, file, line);
    269.           return;

crypto/mem.c:267:30: Taking true branch
    265.   void CRYPTO_free(void *str, const char *file, int line)
    266.   {
    267.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    268.           free_impl(str, file, line);
    269.           return;

crypto/mem.c:268:9: Skipping __function_pointer__(): unresolved function pointer
    266.   {
    267.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    268.           free_impl(str, file, line);
                   ^
    269.           return;
    270.       }

crypto/mem.c:269:9: 
    267.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    268.           free_impl(str, file, line);
    269. >         return;
    270.       }
    271.   

crypto/mem.c:283:1: return from a call to CRYPTO_free
    281.       free(str);
    282.   #endif
    283. > }
    284.   
    285.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/ct/ct_log.c:267:9: 
  265.       if (log != NULL) {
  266.           OPENSSL_free(log->name);
  267. >         EVP_PKEY_free(log->public_key);
  268.           OPENSSL_free(log);
  269.       }

crypto/evp/p_lib.c:418:1: start of procedure EVP_PKEY_free()
    416.   }
    417.   
    418. > void EVP_PKEY_free(EVP_PKEY *x)
    419.   {
    420.       int i;

crypto/evp/p_lib.c:422:9: Taking true branch
    420.       int i;
    421.   
    422.       if (x == NULL)
                   ^
    423.           return;
    424.   

crypto/evp/p_lib.c:423:9: 
    421.   
    422.       if (x == NULL)
    423. >         return;
    424.   
    425.       CRYPTO_DOWN_REF(&x->references, &i, x->lock);

crypto/evp/p_lib.c:434:1: return from a call to EVP_PKEY_free
    432.       sk_X509_ATTRIBUTE_pop_free(x->attributes, X509_ATTRIBUTE_free);
    433.       OPENSSL_free(x);
    434. > }
    435.   
    436.   static void EVP_PKEY_free_it(EVP_PKEY *x)

crypto/ct/ct_log.c:268:9: 
  266.           OPENSSL_free(log->name);
  267.           EVP_PKEY_free(log->public_key);
  268. >         OPENSSL_free(log);
  269.       }
  270.   }

crypto/mem.c:265:1: start of procedure CRYPTO_free()
    263.   }
    264.   
    265. > void CRYPTO_free(void *str, const char *file, int line)
    266.   {
    267.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:267:9: Taking false branch
    265.   void CRYPTO_free(void *str, const char *file, int line)
    266.   {
    267.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    268.           free_impl(str, file, line);
    269.           return;

crypto/mem.c:281:5: 
    279.       }
    280.   #else
    281. >     free(str);
    282.   #endif
    283.   }

crypto/mem.c:283:1: return from a call to CRYPTO_free
    281.       free(str);
    282.   #endif
    283. > }
    284.   
    285.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/ct/ct_log.c:265:5: 
  263.   void CTLOG_free(CTLOG *log)
  264.   {
  265. >     if (log != NULL) {
  266.           OPENSSL_free(log->name);
  267.           EVP_PKEY_free(log->public_key);

crypto/ct/ct_log.c:270:1: return from a call to CTLOG_free
  268.           OPENSSL_free(log);
  269.       }
  270. > }
  271.   
  272.   const char *CTLOG_get0_name(const CTLOG *log)
