crypto/evp/evp_pbe.c:180: error: MEMORY_LEAK
  memory dynamically allocated to `return` by call to `CRYPTO_malloc()` at line 167, column 20 is not reachable after line 180, column 5.
Showing all 31 steps of the trace


crypto/evp/evp_pbe.c:156:1: start of procedure EVP_PBE_alg_add_type()
154.   /* Add a PBE algorithm */
155.   
156. > int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid,
157.                            int md_nid, EVP_PBE_KEYGEN *keygen)
158.   {

crypto/evp/evp_pbe.c:161:9: Taking true branch
159.       EVP_PBE_CTL *pbe_tmp;
160.   
161.       if (pbe_algs == NULL) {
               ^
162.           pbe_algs = sk_EVP_PBE_CTL_new(pbe_cmp);
163.           if (pbe_algs == NULL)

crypto/evp/evp_pbe.c:162:9: 
160.   
161.       if (pbe_algs == NULL) {
162. >         pbe_algs = sk_EVP_PBE_CTL_new(pbe_cmp);
163.           if (pbe_algs == NULL)
164.               goto err;

crypto/evp/evp_locl.h:66:1: start of procedure sk_EVP_PBE_CTL_new()
  64.   
  65.   typedef struct evp_pbe_st EVP_PBE_CTL;
  66. > DEFINE_STACK_OF(EVP_PBE_CTL)

crypto/evp/evp_locl.h:66:1: return from a call to sk_EVP_PBE_CTL_new
  64.   
  65.   typedef struct evp_pbe_st EVP_PBE_CTL;
  66. > DEFINE_STACK_OF(EVP_PBE_CTL)

crypto/evp/evp_pbe.c:163:13: Taking false branch
161.       if (pbe_algs == NULL) {
162.           pbe_algs = sk_EVP_PBE_CTL_new(pbe_cmp);
163.           if (pbe_algs == NULL)
                   ^
164.               goto err;
165.       }

crypto/evp/evp_pbe.c:167:9: 
165.       }
166.   
167. >     if ((pbe_tmp = OPENSSL_malloc(sizeof(*pbe_tmp))) == NULL)
168.           goto err;
169.   

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/evp/evp_pbe.c:167:9: Taking false branch
165.       }
166.   
167.       if ((pbe_tmp = OPENSSL_malloc(sizeof(*pbe_tmp))) == NULL)
               ^
168.           goto err;
169.   

crypto/evp/evp_pbe.c:170:5: 
168.           goto err;
169.   
170. >     pbe_tmp->pbe_type = pbe_type;
171.       pbe_tmp->pbe_nid = pbe_nid;
172.       pbe_tmp->cipher_nid = cipher_nid;

crypto/evp/evp_pbe.c:171:5: 
169.   
170.       pbe_tmp->pbe_type = pbe_type;
171. >     pbe_tmp->pbe_nid = pbe_nid;
172.       pbe_tmp->cipher_nid = cipher_nid;
173.       pbe_tmp->md_nid = md_nid;

crypto/evp/evp_pbe.c:172:5: 
170.       pbe_tmp->pbe_type = pbe_type;
171.       pbe_tmp->pbe_nid = pbe_nid;
172. >     pbe_tmp->cipher_nid = cipher_nid;
173.       pbe_tmp->md_nid = md_nid;
174.       pbe_tmp->keygen = keygen;

crypto/evp/evp_pbe.c:173:5: 
171.       pbe_tmp->pbe_nid = pbe_nid;
172.       pbe_tmp->cipher_nid = cipher_nid;
173. >     pbe_tmp->md_nid = md_nid;
174.       pbe_tmp->keygen = keygen;
175.   

crypto/evp/evp_pbe.c:174:5: 
172.       pbe_tmp->cipher_nid = cipher_nid;
173.       pbe_tmp->md_nid = md_nid;
174. >     pbe_tmp->keygen = keygen;
175.   
176.       if (!sk_EVP_PBE_CTL_push(pbe_algs, pbe_tmp)) {

crypto/evp/evp_pbe.c:176:10: 
174.       pbe_tmp->keygen = keygen;
175.   
176. >     if (!sk_EVP_PBE_CTL_push(pbe_algs, pbe_tmp)) {
177.           OPENSSL_free(pbe_tmp);
178.           goto err;

crypto/evp/evp_locl.h:66:1: start of procedure sk_EVP_PBE_CTL_push()
  64.   
  65.   typedef struct evp_pbe_st EVP_PBE_CTL;
  66. > DEFINE_STACK_OF(EVP_PBE_CTL)

crypto/stack/stack.c:200:1: start of procedure OPENSSL_sk_push()
    198.   }
    199.   
    200. > int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data)
    201.   {
    202.       return (OPENSSL_sk_insert(st, data, st->num));

crypto/stack/stack.c:202:5: Skipping OPENSSL_sk_insert(): empty list of specs
    200.   int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data)
    201.   {
    202.       return (OPENSSL_sk_insert(st, data, st->num));
               ^
    203.   }
    204.   

crypto/stack/stack.c:203:1: return from a call to OPENSSL_sk_push
    201.   {
    202.       return (OPENSSL_sk_insert(st, data, st->num));
    203. > }
    204.   
    205.   int OPENSSL_sk_unshift(OPENSSL_STACK *st, const void *data)

crypto/evp/evp_locl.h:66:1: return from a call to sk_EVP_PBE_CTL_push
  64.   
  65.   typedef struct evp_pbe_st EVP_PBE_CTL;
  66. > DEFINE_STACK_OF(EVP_PBE_CTL)

crypto/evp/evp_pbe.c:176:10: Taking false branch
174.       pbe_tmp->keygen = keygen;
175.   
176.       if (!sk_EVP_PBE_CTL_push(pbe_algs, pbe_tmp)) {
                ^
177.           OPENSSL_free(pbe_tmp);
178.           goto err;

crypto/evp/evp_pbe.c:180:5: 
178.           goto err;
179.       }
180. >     return 1;
181.   
182.    err:

int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid,
                         int md_nid, EVP_PBE_KEYGEN *keygen)
{
    EVP_PBE_CTL *pbe_tmp;
    if (pbe_algs == NULL) {
        pbe_algs = sk_EVP_PBE_CTL_new(pbe_cmp);
        if (pbe_algs == NULL)
            goto err;
    }
    if ((pbe_tmp = OPENSSL_malloc(sizeof(*pbe_tmp))) == NULL)
        goto err;
    pbe_tmp->pbe_type = pbe_type;
    pbe_tmp->pbe_nid = pbe_nid;
    pbe_tmp->cipher_nid = cipher_nid;
    pbe_tmp->md_nid = md_nid;
    pbe_tmp->keygen = keygen;
    if (!sk_EVP_PBE_CTL_push(pbe_algs, pbe_tmp)) {
        OPENSSL_free(pbe_tmp);
        goto err;
    }
    return 1;
 err:
    EVPerr(EVP_F_EVP_PBE_ALG_ADD_TYPE, ERR_R_MALLOC_FAILURE);
    return 0;
}
['int EVP_PBE_alg_add_type(int pbe_type, int pbe_nid, int cipher_nid,\n                         int md_nid, EVP_PBE_KEYGEN *keygen)\n{\n    EVP_PBE_CTL *pbe_tmp;\n    if (pbe_algs == NULL) {\n        pbe_algs = sk_EVP_PBE_CTL_new(pbe_cmp);\n        if (pbe_algs == NULL)\n            goto err;\n    }\n    if ((pbe_tmp = OPENSSL_malloc(sizeof(*pbe_tmp))) == NULL)\n        goto err;\n    pbe_tmp->pbe_type = pbe_type;\n    pbe_tmp->pbe_nid = pbe_nid;\n    pbe_tmp->cipher_nid = cipher_nid;\n    pbe_tmp->md_nid = md_nid;\n    pbe_tmp->keygen = keygen;\n    if (!sk_EVP_PBE_CTL_push(pbe_algs, pbe_tmp)) {\n        OPENSSL_free(pbe_tmp);\n        goto err;\n    }\n    return 1;\n err:\n    EVPerr(EVP_F_EVP_PBE_ALG_ADD_TYPE, ERR_R_MALLOC_FAILURE);\n    return 0;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)\n        return malloc_impl(num, file, line);\n    if (num <= 0)\n        return NULL;\n    allow_customize = 0;\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);\n        ret = malloc(num);\n        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);\n    } else {\n        ret = malloc(num);\n    }\n#else\n    osslargused(file); osslargused(line);\n    ret = malloc(num);\n#endif\n    return ret;\n}', 'int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data)\n{\n    return (OPENSSL_sk_insert(st, data, st->num));\n}']