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


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

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

crypto/evp/evp_pbe.c:164:9: 
162.   
163.       if (pbe_algs == NULL) {
164. >         pbe_algs = sk_EVP_PBE_CTL_new(pbe_cmp);
165.           if (pbe_algs == NULL)
166.               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)
  67.   
  68.   int is_partially_overlapping(const void *ptr1, const void *ptr2, int len);

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)
  67.   
  68.   int is_partially_overlapping(const void *ptr1, const void *ptr2, int len);

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

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

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

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

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

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

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

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

crypto/evp/evp_pbe.c:178:10: 
176.       pbe_tmp->keygen = keygen;
177.   
178. >     if (!sk_EVP_PBE_CTL_push(pbe_algs, pbe_tmp)) {
179.           OPENSSL_free(pbe_tmp);
180.           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)
  67.   
  68.   int is_partially_overlapping(const void *ptr1, const void *ptr2, int len);

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)
  67.   
  68.   int is_partially_overlapping(const void *ptr1, const void *ptr2, int len);

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

crypto/evp/evp_pbe.c:182:5: 
180.           goto err;
181.       }
182. >     return 1;
183.   
184.    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}', 'DEFINE_STACK_OF(EVP_PBE_CTL)', '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    (void)(file); (void)(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}']