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


crypto/ct/ct_log.c:229:1: start of procedure CTLOG_new()
227.    * Copies the name.
228.    */
229. > CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name)
230.   {
231.       CTLOG *ret = CTLOG_new_null();

crypto/ct/ct_log.c:231:5: 
229.   CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name)
230.   {
231. >     CTLOG *ret = CTLOG_new_null();
232.   
233.       if (ret == NULL)

crypto/ct/ct_log.c:250:1: start of procedure CTLOG_new_null()
  248.   }
  249.   
  250. > CTLOG *CTLOG_new_null(void)
  251.   {
  252.       CTLOG *ret = OPENSSL_zalloc(sizeof(*ret));

crypto/ct/ct_log.c:252:5: 
  250.   CTLOG *CTLOG_new_null(void)
  251.   {
  252. >     CTLOG *ret = OPENSSL_zalloc(sizeof(*ret));
  253.   
  254.       if (ret == NULL)

crypto/mem.c:98:1: start of procedure CRYPTO_zalloc()
    96.   }
    97.   
    98. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    99.   {
    100.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:100:5: 
    98.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    99.   {
    100. >     void *ret = CRYPTO_malloc(num, file, line);
    101.   
    102.       if (ret != NULL)

crypto/mem.c:71:1: start of procedure CRYPTO_malloc()
      69.   }
      70.   
      71. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      72.   {
      73.       void *ret = NULL;

crypto/mem.c:73:5: 
      71.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      72.   {
      73. >     void *ret = NULL;
      74.   
      75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:75:9: Taking false branch
      73.       void *ret = NULL;
      74.   
      75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                    ^
      76.           return malloc_impl(num, file, line);
      77.   

crypto/mem.c:78:9: Taking false branch
      76.           return malloc_impl(num, file, line);
      77.   
      78.       if (num <= 0)
                    ^
      79.           return NULL;
      80.   

crypto/mem.c:81:5: 
      79.           return NULL;
      80.   
      81. >     allow_customize = 0;
      82.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      83.       if (call_malloc_debug) {

crypto/mem.c:91:5: 
      89.       }
      90.   #else
      91. >     osslargused(file); osslargused(line);
      92.       ret = malloc(num);
      93.   #endif

crypto/mem.c:91:24: 
      89.       }
      90.   #else
      91. >     osslargused(file); osslargused(line);
      92.       ret = malloc(num);
      93.   #endif

crypto/mem.c:92:5: 
      90.   #else
      91.       osslargused(file); osslargused(line);
      92. >     ret = malloc(num);
      93.   #endif
      94.   

crypto/mem.c:95:5: 
      93.   #endif
      94.   
      95. >     return ret;
      96.   }
      97.   

crypto/mem.c:96:1: return from a call to CRYPTO_malloc
      94.   
      95.       return ret;
      96. > }
      97.   
      98.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:102:9: Taking true branch
    100.       void *ret = CRYPTO_malloc(num, file, line);
    101.   
    102.       if (ret != NULL)
                   ^
    103.           memset(ret, 0, num);
    104.       return ret;

crypto/mem.c:103:9: 
    101.   
    102.       if (ret != NULL)
    103. >         memset(ret, 0, num);
    104.       return ret;
    105.   }

crypto/mem.c:104:5: 
    102.       if (ret != NULL)
    103.           memset(ret, 0, num);
    104. >     return ret;
    105.   }
    106.   

crypto/mem.c:105:1: return from a call to CRYPTO_zalloc
    103.           memset(ret, 0, num);
    104.       return ret;
    105. > }
    106.   
    107.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/ct/ct_log.c:254:9: Taking false branch
  252.       CTLOG *ret = OPENSSL_zalloc(sizeof(*ret));
  253.   
  254.       if (ret == NULL)
                 ^
  255.           CTerr(CT_F_CTLOG_NEW_NULL, ERR_R_MALLOC_FAILURE);
  256.   

crypto/ct/ct_log.c:257:5: 
  255.           CTerr(CT_F_CTLOG_NEW_NULL, ERR_R_MALLOC_FAILURE);
  256.   
  257. >     return ret;
  258.   }
  259.   

crypto/ct/ct_log.c:258:1: return from a call to CTLOG_new_null
  256.   
  257.       return ret;
  258. > }
  259.   
  260.   /* Frees CT log and associated structures */

crypto/ct/ct_log.c:233:9: Taking false branch
231.       CTLOG *ret = CTLOG_new_null();
232.   
233.       if (ret == NULL)
               ^
234.           goto err;
235.   

crypto/ct/ct_log.c:236:5: 
234.           goto err;
235.   
236. >     ret->name = OPENSSL_strdup(name);
237.       if (ret->name == NULL)
238.           goto err;

crypto/o_str.c:71:1: start of procedure CRYPTO_strdup()
  69.   }
  70.   
  71. > char *CRYPTO_strdup(const char *str, const char* file, int line)
  72.   {
  73.       char *ret;

crypto/o_str.c:76:9: Taking false branch
  74.       size_t size;
  75.   
  76.       if (str == NULL)
                ^
  77.           return NULL;
  78.       size = strlen(str) + 1;

crypto/o_str.c:78:5: 
  76.       if (str == NULL)
  77.           return NULL;
  78. >     size = strlen(str) + 1;
  79.       ret = CRYPTO_malloc(size, file, line);
  80.       if (ret != NULL)

crypto/o_str.c:79:5: 
  77.           return NULL;
  78.       size = strlen(str) + 1;
  79. >     ret = CRYPTO_malloc(size, file, line);
  80.       if (ret != NULL)
  81.           memcpy(ret, str, size);

crypto/mem.c:71:1: start of procedure CRYPTO_malloc()
    69.   }
    70.   
    71. > void *CRYPTO_malloc(size_t num, const char *file, int line)
    72.   {
    73.       void *ret = NULL;

crypto/mem.c:73:5: 
    71.   void *CRYPTO_malloc(size_t num, const char *file, int line)
    72.   {
    73. >     void *ret = NULL;
    74.   
    75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:75:9: Taking true branch
    73.       void *ret = NULL;
    74.   
    75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                  ^
    76.           return malloc_impl(num, file, line);
    77.   

crypto/mem.c:75:32: Taking true branch
    73.       void *ret = NULL;
    74.   
    75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                                         ^
    76.           return malloc_impl(num, file, line);
    77.   

crypto/mem.c:76:9: Skipping __function_pointer__(): unresolved function pointer
    74.   
    75.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
    76.           return malloc_impl(num, file, line);
                  ^
    77.   
    78.       if (num <= 0)

crypto/mem.c:96:1: return from a call to CRYPTO_malloc
    94.   
    95.       return ret;
    96. > }
    97.   
    98.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/o_str.c:80:9: Taking true branch
  78.       size = strlen(str) + 1;
  79.       ret = CRYPTO_malloc(size, file, line);
  80.       if (ret != NULL)
                ^
  81.           memcpy(ret, str, size);
  82.       return ret;

crypto/o_str.c:81:9: 
  79.       ret = CRYPTO_malloc(size, file, line);
  80.       if (ret != NULL)
  81. >         memcpy(ret, str, size);
  82.       return ret;
  83.   }

crypto/o_str.c:82:5: 
  80.       if (ret != NULL)
  81.           memcpy(ret, str, size);
  82. >     return ret;
  83.   }
  84.   

crypto/o_str.c:83:1: return from a call to CRYPTO_strdup
  81.           memcpy(ret, str, size);
  82.       return ret;
  83. > }
  84.   
  85.   char *CRYPTO_strndup(const char *str, size_t s, const char* file, int line)

crypto/ct/ct_log.c:237:9: Taking false branch
235.   
236.       ret->name = OPENSSL_strdup(name);
237.       if (ret->name == NULL)
               ^
238.           goto err;
239.   

crypto/ct/ct_log.c:240:5: 
238.           goto err;
239.   
240. >     ret->public_key = public_key;
241.       if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1)
242.           goto err;

crypto/ct/ct_log.c:241:9: 
239.   
240.       ret->public_key = public_key;
241. >     if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1)
242.           goto err;
243.   

crypto/ct/ct_log.c:78:1: start of procedure ct_v1_log_id_from_pkey()
  76.   
  77.   /* Converts a log's public key into a SHA256 log ID */
  78. > static int ct_v1_log_id_from_pkey(EVP_PKEY *pkey,
  79.                                     unsigned char log_id[CT_V1_HASHLEN])
  80.   {

crypto/ct/ct_log.c:81:5: 
  79.                                     unsigned char log_id[CT_V1_HASHLEN])
  80.   {
  81. >     int ret = 0;
  82.       unsigned char *pkey_der = NULL;
  83.       int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der);

crypto/ct/ct_log.c:82:5: 
  80.   {
  81.       int ret = 0;
  82. >     unsigned char *pkey_der = NULL;
  83.       int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der);
  84.   

crypto/ct/ct_log.c:83:5: 
  81.       int ret = 0;
  82.       unsigned char *pkey_der = NULL;
  83. >     int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der);
  84.   
  85.       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:85:9: Taking true branch
  83.       int pkey_der_len = i2d_PUBKEY(pkey, &pkey_der);
  84.   
  85.       if (pkey_der_len <= 0) {
                ^
  86.           CTerr(CT_F_CT_V1_LOG_ID_FROM_PKEY, CT_R_LOG_KEY_INVALID);
  87.           goto err;

crypto/ct/ct_log.c:86:9: Skipping ERR_put_error(): empty list of specs
  84.   
  85.       if (pkey_der_len <= 0) {
  86.           CTerr(CT_F_CT_V1_LOG_ID_FROM_PKEY, CT_R_LOG_KEY_INVALID);
                ^
  87.           goto err;
  88.       }

crypto/ct/ct_log.c:92:1: 
  90.       SHA256(pkey_der, pkey_der_len, log_id);
  91.       ret = 1;
  92. > err:
  93.       OPENSSL_free(pkey_der);
  94.       return ret;

crypto/ct/ct_log.c:93:5: 
  91.       ret = 1;
  92.   err:
  93. >     OPENSSL_free(pkey_der);
  94.       return ret;
  95.   }

crypto/mem.c:163:1: start of procedure CRYPTO_free()
    161.   }
    162.   
    163. > void CRYPTO_free(void *str, const char *file, int line)
    164.   {
    165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:165:9: Taking false branch
    163.   void CRYPTO_free(void *str, const char *file, int line)
    164.   {
    165.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    166.           free_impl(str, file, line);
    167.           return;

crypto/mem.c:179:5: 
    177.       }
    178.   #else
    179. >     free(str);
    180.   #endif
    181.   }

crypto/mem.c:181:1: return from a call to CRYPTO_free
    179.       free(str);
    180.   #endif
    181. > }
    182.   
    183.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/ct/ct_log.c:94:5: 
  92.   err:
  93.       OPENSSL_free(pkey_der);
  94. >     return ret;
  95.   }
  96.   

crypto/ct/ct_log.c:95:1: return from a call to ct_v1_log_id_from_pkey
  93.       OPENSSL_free(pkey_der);
  94.       return ret;
  95. > }
  96.   
  97.   CTLOG_STORE *CTLOG_STORE_new(void)

crypto/ct/ct_log.c:241:9: Taking true branch
239.   
240.       ret->public_key = public_key;
241.       if (ct_v1_log_id_from_pkey(public_key, ret->log_id) != 1)
               ^
242.           goto err;
243.   

crypto/ct/ct_log.c:245:1: 
243.   
244.       return ret;
245. > err:
246.       CTLOG_free(ret);
247.       return NULL;

crypto/ct/ct_log.c:246:5: Skipping CTLOG_free(): empty list of specs
244.       return ret;
245.   err:
246.       CTLOG_free(ret);
           ^
247.       return NULL;
248.   }
