crypto/pkcs12/p12_decr.c:121: error: MEMORY_LEAK
  memory dynamically allocated by call to `EVP_CIPHER_CTX_new()` at line 79, column 27 is not reachable after line 121, column 5.
Showing all 27 steps of the trace


crypto/pkcs12/p12_decr.c:73:1: start of procedure PKCS12_pbe_crypt()
71.    */
72.   
73. > unsigned char *PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass,
74.                                   int passlen, unsigned char *in, int inlen,
75.                                   unsigned char **data, int *datalen, int en_de)

crypto/pkcs12/p12_decr.c:77:5: 
75.                                   unsigned char **data, int *datalen, int en_de)
76.   {
77. >     unsigned char *out = NULL;
78.       int outlen, i;
79.       EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();

crypto/pkcs12/p12_decr.c:79:5: 
77.       unsigned char *out = NULL;
78.       int outlen, i;
79. >     EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
80.   
81.       if (ctx == NULL) {

crypto/evp/evp_enc.c:88:1: start of procedure EVP_CIPHER_CTX_new()
  86.   }
  87.   
  88. > EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void)
  89.   {
  90.       return OPENSSL_zalloc(sizeof(EVP_CIPHER_CTX));

crypto/evp/evp_enc.c:90:5: 
  88.   EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void)
  89.   {
  90. >     return OPENSSL_zalloc(sizeof(EVP_CIPHER_CTX));
  91.   }
  92.   

crypto/mem.c:146:1: start of procedure CRYPTO_zalloc()
    144.   }
    145.   
    146. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    147.   {
    148.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:148:5: 
    146.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    147.   {
    148. >     void *ret = CRYPTO_malloc(num, file, line);
    149.   
    150.       if (ret != NULL)

crypto/mem.c:119:1: start of procedure CRYPTO_malloc()
      117.   }
      118.   
      119. > void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121.       void *ret = NULL;

crypto/mem.c:121:5: 
      119.   void *CRYPTO_malloc(size_t num, const char *file, int line)
      120.   {
      121. >     void *ret = NULL;
      122.   
      123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)

crypto/mem.c:123:9: Taking false branch
      121.       void *ret = NULL;
      122.   
      123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                     ^
      124.           return malloc_impl(num, file, line);
      125.   

crypto/mem.c:126:9: Taking false branch
      124.           return malloc_impl(num, file, line);
      125.   
      126.       if (num <= 0)
                     ^
      127.           return NULL;
      128.   

crypto/mem.c:129:5: 
      127.           return NULL;
      128.   
      129. >     allow_customize = 0;
      130.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
      131.       if (call_malloc_debug) {

crypto/mem.c:139:5: 
      137.       }
      138.   #else
      139. >     osslargused(file); osslargused(line);
      140.       ret = malloc(num);
      141.   #endif

crypto/mem.c:139:24: 
      137.       }
      138.   #else
      139. >     osslargused(file); osslargused(line);
      140.       ret = malloc(num);
      141.   #endif

crypto/mem.c:140:5: 
      138.   #else
      139.       osslargused(file); osslargused(line);
      140. >     ret = malloc(num);
      141.   #endif
      142.   

crypto/mem.c:143:5: 
      141.   #endif
      142.   
      143. >     return ret;
      144.   }
      145.   

crypto/mem.c:144:1: return from a call to CRYPTO_malloc
      142.   
      143.       return ret;
      144. > }
      145.   
      146.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:150:9: Taking true branch
    148.       void *ret = CRYPTO_malloc(num, file, line);
    149.   
    150.       if (ret != NULL)
                   ^
    151.           memset(ret, 0, num);
    152.       return ret;

crypto/mem.c:151:9: 
    149.   
    150.       if (ret != NULL)
    151. >         memset(ret, 0, num);
    152.       return ret;
    153.   }

crypto/mem.c:152:5: 
    150.       if (ret != NULL)
    151.           memset(ret, 0, num);
    152. >     return ret;
    153.   }
    154.   

crypto/mem.c:153:1: return from a call to CRYPTO_zalloc
    151.           memset(ret, 0, num);
    152.       return ret;
    153. > }
    154.   
    155.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/evp/evp_enc.c:91:1: return from a call to EVP_CIPHER_CTX_new
  89.   {
  90.       return OPENSSL_zalloc(sizeof(EVP_CIPHER_CTX));
  91. > }
  92.   
  93.   void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *ctx)

crypto/pkcs12/p12_decr.c:81:9: Taking false branch
79.       EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
80.   
81.       if (ctx == NULL) {
              ^
82.           PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT, ERR_R_MALLOC_FAILURE);
83.           goto err;

crypto/pkcs12/p12_decr.c:87:10: Taking true branch
85.   
86.       /* Decrypt data */
87.       if (!EVP_PBE_CipherInit(algor->algorithm, pass, passlen,
               ^
88.                               algor->parameter, ctx, en_de)) {
89.           PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,

crypto/pkcs12/p12_decr.c:89:9: Skipping ERR_put_error(): empty list of specs
87.       if (!EVP_PBE_CipherInit(algor->algorithm, pass, passlen,
88.                               algor->parameter, ctx, en_de)) {
89.           PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,
              ^
90.                     PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR);
91.           goto err;

crypto/pkcs12/p12_decr.c:120:2: 
118.       if (data)
119.           *data = out;
120. >  err:
121.       EVP_CIPHER_CTX_free(ctx);
122.       return out;

crypto/pkcs12/p12_decr.c:121:5: Skipping EVP_CIPHER_CTX_free(): empty list of specs
119.           *data = out;
120.    err:
121.       EVP_CIPHER_CTX_free(ctx);
           ^
122.       return out;
123.   

unsigned char *PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass,
                                int passlen, unsigned char *in, int inlen,
                                unsigned char **data, int *datalen, int en_de)
{
    unsigned char *out = NULL;
    int outlen, i;
    EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();
    if (ctx == NULL) {
        PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT, ERR_R_MALLOC_FAILURE);
        goto err;
    }
    if (!EVP_PBE_CipherInit(algor->algorithm, pass, passlen,
                            algor->parameter, ctx, en_de)) {
        PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,
                  PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR);
        goto err;
    }
    if ((out = OPENSSL_malloc(inlen + EVP_CIPHER_CTX_block_size(ctx)))
            == NULL) {
        PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT, ERR_R_MALLOC_FAILURE);
        goto err;
    }
    if (!EVP_CipherUpdate(ctx, out, &i, in, inlen)) {
        OPENSSL_free(out);
        out = NULL;
        PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT, ERR_R_EVP_LIB);
        goto err;
    }
    outlen = i;
    if (!EVP_CipherFinal_ex(ctx, out + i, &i)) {
        OPENSSL_free(out);
        out = NULL;
        PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,
                  PKCS12_R_PKCS12_CIPHERFINAL_ERROR);
        goto err;
    }
    outlen += i;
    if (datalen)
        *datalen = outlen;
    if (data)
        *data = out;
 err:
    EVP_CIPHER_CTX_free(ctx);
    return out;
}
['unsigned char *PKCS12_pbe_crypt(X509_ALGOR *algor, const char *pass,\n                                int passlen, unsigned char *in, int inlen,\n                                unsigned char **data, int *datalen, int en_de)\n{\n    unsigned char *out = NULL;\n    int outlen, i;\n    EVP_CIPHER_CTX *ctx = EVP_CIPHER_CTX_new();\n    if (ctx == NULL) {\n        PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT, ERR_R_MALLOC_FAILURE);\n        goto err;\n    }\n    if (!EVP_PBE_CipherInit(algor->algorithm, pass, passlen,\n                            algor->parameter, ctx, en_de)) {\n        PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,\n                  PKCS12_R_PKCS12_ALGOR_CIPHERINIT_ERROR);\n        goto err;\n    }\n    if ((out = OPENSSL_malloc(inlen + EVP_CIPHER_CTX_block_size(ctx)))\n            == NULL) {\n        PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT, ERR_R_MALLOC_FAILURE);\n        goto err;\n    }\n    if (!EVP_CipherUpdate(ctx, out, &i, in, inlen)) {\n        OPENSSL_free(out);\n        out = NULL;\n        PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT, ERR_R_EVP_LIB);\n        goto err;\n    }\n    outlen = i;\n    if (!EVP_CipherFinal_ex(ctx, out + i, &i)) {\n        OPENSSL_free(out);\n        out = NULL;\n        PKCS12err(PKCS12_F_PKCS12_PBE_CRYPT,\n                  PKCS12_R_PKCS12_CIPHERFINAL_ERROR);\n        goto err;\n    }\n    outlen += i;\n    if (datalen)\n        *datalen = outlen;\n    if (data)\n        *data = out;\n err:\n    EVP_CIPHER_CTX_free(ctx);\n    return out;\n}', 'EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void)\n{\n    return OPENSSL_zalloc(sizeof(EVP_CIPHER_CTX));\n}', 'void *CRYPTO_zalloc(size_t num, const char *file, int line)\n{\n    void *ret = CRYPTO_malloc(num, file, line);\n    if (ret != NULL)\n        memset(ret, 0, num);\n    return ret;\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}']