crypto/ec/ecx_meth.c:114: error: MEMORY_LEAK
  memory dynamically allocated to `return` by call to `CRYPTO_memdup()` at line 102, column 12 is not reachable after line 114, column 5.
Showing all 32 steps of the trace


crypto/ec/ecx_meth.c:92:1: start of procedure ecx_pub_encode()
90.   }
91.   
92. > static int ecx_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
93.   {
94.       const X25519_KEY *xkey = pkey->pkey.ptr;

crypto/ec/ecx_meth.c:94:5: 
92.   static int ecx_pub_encode(X509_PUBKEY *pk, const EVP_PKEY *pkey)
93.   {
94. >     const X25519_KEY *xkey = pkey->pkey.ptr;
95.       unsigned char *penc;
96.   

crypto/ec/ecx_meth.c:97:9: Taking false branch
95.       unsigned char *penc;
96.   
97.       if (xkey == NULL) {
               ^
98.           ECerr(EC_F_ECX_PUB_ENCODE, EC_R_INVALID_KEY);
99.           return 0;

crypto/ec/ecx_meth.c:102:5: 
100.       }
101.   
102. >     penc = OPENSSL_memdup(xkey->pubkey, X25519_KEYLEN);
103.       if (penc == NULL) {
104.           ECerr(EC_F_ECX_PUB_ENCODE, ERR_R_MALLOC_FAILURE);

crypto/o_str.c:60:1: start of procedure CRYPTO_memdup()
  58.   }
  59.   
  60. > void *CRYPTO_memdup(const void *data, size_t siz, const char* file, int line)
  61.   {
  62.       void *ret;

crypto/o_str.c:64:9: Taking false branch
  62.       void *ret;
  63.   
  64.       if (data == NULL || siz >= INT_MAX)
                ^
  65.           return NULL;
  66.   

crypto/o_str.c:64:25: Taking false branch
  62.       void *ret;
  63.   
  64.       if (data == NULL || siz >= INT_MAX)
                                ^
  65.           return NULL;
  66.   

crypto/o_str.c:67:5: 
  65.           return NULL;
  66.   
  67. >     ret = CRYPTO_malloc(siz, file, line);
  68.       if (ret == NULL) {
  69.           CRYPTOerr(CRYPTO_F_CRYPTO_MEMDUP, ERR_R_MALLOC_FAILURE);

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/o_str.c:68:9: Taking false branch
  66.   
  67.       ret = CRYPTO_malloc(siz, file, line);
  68.       if (ret == NULL) {
                ^
  69.           CRYPTOerr(CRYPTO_F_CRYPTO_MEMDUP, ERR_R_MALLOC_FAILURE);
  70.           return NULL;

crypto/o_str.c:72:5: 
  70.           return NULL;
  71.       }
  72. >     return memcpy(ret, data, siz);
  73.   }
  74.   

crypto/o_str.c:73:1: return from a call to CRYPTO_memdup
  71.       }
  72.       return memcpy(ret, data, siz);
  73. > }
  74.   
  75.   size_t OPENSSL_strnlen(const char *str, size_t maxlen)

crypto/ec/ecx_meth.c:103:9: Taking false branch
101.   
102.       penc = OPENSSL_memdup(xkey->pubkey, X25519_KEYLEN);
103.       if (penc == NULL) {
               ^
104.           ECerr(EC_F_ECX_PUB_ENCODE, ERR_R_MALLOC_FAILURE);
105.           return 0;

crypto/ec/ecx_meth.c:108:10: 
106.       }
107.   
108. >     if (!X509_PUBKEY_set0_param(pk, OBJ_nid2obj(NID_X25519), V_ASN1_UNDEF,
109.                                   NULL, penc, X25519_KEYLEN)) {
110.           OPENSSL_free(penc);

crypto/objects/obj_dat.c:220:1: start of procedure OBJ_nid2obj()
  218.   }
  219.   
  220. > ASN1_OBJECT *OBJ_nid2obj(int n)
  221.   {
  222.       ADDED_OBJ ad, *adp;

crypto/objects/obj_dat.c:225:10: Taking true branch
  223.       ASN1_OBJECT ob;
  224.   
  225.       if ((n >= 0) && (n < NUM_NID)) {
                  ^
  226.           if ((n != NID_undef) && (nid_objs[n].nid == NID_undef)) {
  227.               OBJerr(OBJ_F_OBJ_NID2OBJ, OBJ_R_UNKNOWN_NID);

crypto/objects/obj_dat.c:225:22: Taking true branch
  223.       ASN1_OBJECT ob;
  224.   
  225.       if ((n >= 0) && (n < NUM_NID)) {
                              ^
  226.           if ((n != NID_undef) && (nid_objs[n].nid == NID_undef)) {
  227.               OBJerr(OBJ_F_OBJ_NID2OBJ, OBJ_R_UNKNOWN_NID);

crypto/objects/obj_dat.c:226:14: Taking true branch
  224.   
  225.       if ((n >= 0) && (n < NUM_NID)) {
  226.           if ((n != NID_undef) && (nid_objs[n].nid == NID_undef)) {
                      ^
  227.               OBJerr(OBJ_F_OBJ_NID2OBJ, OBJ_R_UNKNOWN_NID);
  228.               return (NULL);

crypto/objects/obj_dat.c:226:34: Taking false branch
  224.   
  225.       if ((n >= 0) && (n < NUM_NID)) {
  226.           if ((n != NID_undef) && (nid_objs[n].nid == NID_undef)) {
                                          ^
  227.               OBJerr(OBJ_F_OBJ_NID2OBJ, OBJ_R_UNKNOWN_NID);
  228.               return (NULL);

crypto/objects/obj_dat.c:230:9: 
  228.               return (NULL);
  229.           }
  230. >         return ((ASN1_OBJECT *)&(nid_objs[n]));
  231.       } else if (added == NULL)
  232.           return (NULL);

crypto/objects/obj_dat.c:245:1: return from a call to OBJ_nid2obj
  243.           }
  244.       }
  245. > }
  246.   
  247.   const char *OBJ_nid2sn(int n)

crypto/ec/ecx_meth.c:108:10: Taking false branch
106.       }
107.   
108.       if (!X509_PUBKEY_set0_param(pk, OBJ_nid2obj(NID_X25519), V_ASN1_UNDEF,
                ^
109.                                   NULL, penc, X25519_KEYLEN)) {
110.           OPENSSL_free(penc);

crypto/ec/ecx_meth.c:114:5: 
112.           return 0;
113.       }
114. >     return 1;
115.   }
116.   
