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:157:1: start of procedure CRYPTO_malloc()
  155.   #endif
  156.   
  157. > void *CRYPTO_malloc(size_t num, const char *file, int line)
  158.   {
  159.       void *ret = NULL;

crypto/mem.c:159:5: 
  157.   void *CRYPTO_malloc(size_t num, const char *file, int line)
  158.   {
  159. >     void *ret = NULL;
  160.   
  161.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:161:9: Taking false branch
  159.       void *ret = NULL;
  160.   
  161.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                 ^
  162.           return malloc_impl(num, file, line);
  163.   

crypto/mem.c:164:9: Taking false branch
  162.           return malloc_impl(num, file, line);
  163.   
  164.       if (num <= 0)
                 ^
  165.           return NULL;
  166.   

crypto/mem.c:168:5: 
  166.   
  167.       FAILTEST();
  168. >     allow_customize = 0;
  169.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
  170.       if (call_malloc_debug) {

crypto/mem.c:178:5: 
  176.       }
  177.   #else
  178. >     osslargused(file); osslargused(line);
  179.       ret = malloc(num);
  180.   #endif

crypto/mem.c:178:24: 
  176.       }
  177.   #else
  178. >     osslargused(file); osslargused(line);
  179.       ret = malloc(num);
  180.   #endif

crypto/mem.c:179:5: 
  177.   #else
  178.       osslargused(file); osslargused(line);
  179. >     ret = malloc(num);
  180.   #endif
  181.   

crypto/mem.c:182:5: 
  180.   #endif
  181.   
  182. >     return ret;
  183.   }
  184.   

crypto/mem.c:183:1: return from a call to CRYPTO_malloc
  181.   
  182.       return ret;
  183. > }
  184.   
  185.   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:219:1: start of procedure OPENSSL_sk_push()
    217.   }
    218.   
    219. > int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data)
    220.   {
    221.       return (OPENSSL_sk_insert(st, data, st->num));

crypto/stack/stack.c:221:5: Skipping OPENSSL_sk_insert(): empty list of specs
    219.   int OPENSSL_sk_push(OPENSSL_STACK *st, const void *data)
    220.   {
    221.       return (OPENSSL_sk_insert(st, data, st->num));
               ^
    222.   }
    223.   

crypto/stack/stack.c:222:1: return from a call to OPENSSL_sk_push
    220.   {
    221.       return (OPENSSL_sk_insert(st, data, st->num));
    222. > }
    223.   
    224.   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    FAILTEST();\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}']