crypto/evp/p_sign.c:88: error: MEMORY_LEAK
  memory dynamically allocated by call to `EVP_MD_CTX_new()` at line 80, column 31 is not reachable after line 88, column 9.
Showing all 81 steps of the trace


crypto/evp/p_sign.c:65:1: start of procedure EVP_SignFinal()
63.   #include "internal/evp_int.h"
64.   
65. > int EVP_SignFinal(EVP_MD_CTX *ctx, unsigned char *sigret,
66.                     unsigned int *siglen, EVP_PKEY *pkey)
67.   {

crypto/evp/p_sign.c:69:5: 
67.   {
68.       unsigned char m[EVP_MAX_MD_SIZE];
69. >     unsigned int m_len = 0;
70.       int i = 0;
71.       size_t sltmp;

crypto/evp/p_sign.c:70:5: 
68.       unsigned char m[EVP_MAX_MD_SIZE];
69.       unsigned int m_len = 0;
70. >     int i = 0;
71.       size_t sltmp;
72.       EVP_PKEY_CTX *pkctx = NULL;

crypto/evp/p_sign.c:72:5: 
70.       int i = 0;
71.       size_t sltmp;
72. >     EVP_PKEY_CTX *pkctx = NULL;
73.   
74.       *siglen = 0;

crypto/evp/p_sign.c:74:5: 
72.       EVP_PKEY_CTX *pkctx = NULL;
73.   
74. >     *siglen = 0;
75.       if (EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_FINALISE)) {
76.           if (!EVP_DigestFinal_ex(ctx, m, &m_len))

crypto/evp/p_sign.c:75:9: 
73.   
74.       *siglen = 0;
75. >     if (EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_FINALISE)) {
76.           if (!EVP_DigestFinal_ex(ctx, m, &m_len))
77.               goto err;

crypto/evp/evp_lib.c:517:1: start of procedure EVP_MD_CTX_test_flags()
  515.   }
  516.   
  517. > int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags)
  518.   {
  519.       return (ctx->flags & flags);

crypto/evp/evp_lib.c:519:5: 
  517.   int EVP_MD_CTX_test_flags(const EVP_MD_CTX *ctx, int flags)
  518.   {
  519. >     return (ctx->flags & flags);
  520.   }
  521.   

crypto/evp/evp_lib.c:520:1: return from a call to EVP_MD_CTX_test_flags
  518.   {
  519.       return (ctx->flags & flags);
  520. > }
  521.   
  522.   void EVP_CIPHER_CTX_set_flags(EVP_CIPHER_CTX *ctx, int flags)

crypto/evp/p_sign.c:75:9: Taking false branch
73.   
74.       *siglen = 0;
75.       if (EVP_MD_CTX_test_flags(ctx, EVP_MD_CTX_FLAG_FINALISE)) {
              ^
76.           if (!EVP_DigestFinal_ex(ctx, m, &m_len))
77.               goto err;

crypto/evp/p_sign.c:79:9: 
77.               goto err;
78.       } else {
79. >         int rv = 0;
80.           EVP_MD_CTX *tmp_ctx = EVP_MD_CTX_new();
81.           if (tmp_ctx == NULL) {

crypto/evp/p_sign.c:80:9: 
78.       } else {
79.           int rv = 0;
80. >         EVP_MD_CTX *tmp_ctx = EVP_MD_CTX_new();
81.           if (tmp_ctx == NULL) {
82.               EVPerr(EVP_F_EVP_SIGNFINAL, ERR_R_MALLOC_FAILURE);

crypto/evp/digest.c:152:1: start of procedure EVP_MD_CTX_new()
  150.   }
  151.   
  152. > EVP_MD_CTX *EVP_MD_CTX_new(void)
  153.   {
  154.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));

crypto/evp/digest.c:154:5: 
  152.   EVP_MD_CTX *EVP_MD_CTX_new(void)
  153.   {
  154. >     return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  155.   }
  156.   

crypto/mem.c:158:1: start of procedure CRYPTO_zalloc()
    156.   }
    157.   
    158. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
    159.   {
    160.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:160:5: 
    158.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
    159.   {
    160. >     void *ret = CRYPTO_malloc(num, file, line);
    161.   
    162.       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:155:5: 
      153.   #endif
      154.   
      155. >     return ret;
      156.   }
      157.   

crypto/mem.c:156:1: return from a call to CRYPTO_malloc
      154.   
      155.       return ret;
      156. > }
      157.   
      158.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:162:9: Taking true branch
    160.       void *ret = CRYPTO_malloc(num, file, line);
    161.   
    162.       if (ret != NULL)
                   ^
    163.           memset(ret, 0, num);
    164.       return ret;

crypto/mem.c:163:9: 
    161.   
    162.       if (ret != NULL)
    163. >         memset(ret, 0, num);
    164.       return ret;
    165.   }

crypto/mem.c:164:5: 
    162.       if (ret != NULL)
    163.           memset(ret, 0, num);
    164. >     return ret;
    165.   }
    166.   

crypto/mem.c:165:1: return from a call to CRYPTO_zalloc
    163.           memset(ret, 0, num);
    164.       return ret;
    165. > }
    166.   
    167.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:155:1: return from a call to EVP_MD_CTX_new
  153.   {
  154.       return OPENSSL_zalloc(sizeof(EVP_MD_CTX));
  155. > }
  156.   
  157.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)

crypto/evp/p_sign.c:81:13: Taking false branch
79.           int rv = 0;
80.           EVP_MD_CTX *tmp_ctx = EVP_MD_CTX_new();
81.           if (tmp_ctx == NULL) {
                  ^
82.               EVPerr(EVP_F_EVP_SIGNFINAL, ERR_R_MALLOC_FAILURE);
83.               return 0;

crypto/evp/p_sign.c:85:9: 
83.               return 0;
84.           }
85. >         rv = EVP_MD_CTX_copy_ex(tmp_ctx, ctx);
86.           if (rv)
87.               rv = EVP_DigestFinal_ex(tmp_ctx, m, &m_len);

crypto/evp/digest.c:291:1: start of procedure EVP_MD_CTX_copy_ex()
  289.   }
  290.   
  291. > int EVP_MD_CTX_copy_ex(EVP_MD_CTX *out, const EVP_MD_CTX *in)
  292.   {
  293.       unsigned char *tmp_buf;

crypto/evp/digest.c:294:10: Taking false branch
  292.   {
  293.       unsigned char *tmp_buf;
  294.       if ((in == NULL) || (in->digest == NULL)) {
                  ^
  295.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, EVP_R_INPUT_NOT_INITIALIZED);
  296.           return 0;

crypto/evp/digest.c:294:26: Taking false branch
  292.   {
  293.       unsigned char *tmp_buf;
  294.       if ((in == NULL) || (in->digest == NULL)) {
                                  ^
  295.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, EVP_R_INPUT_NOT_INITIALIZED);
  296.           return 0;

crypto/evp/digest.c:300:9: Taking true branch
  298.   #ifndef OPENSSL_NO_ENGINE
  299.       /* Make sure it's safe to copy a digest context using an ENGINE */
  300.       if (in->engine && !ENGINE_init(in->engine)) {
                 ^
  301.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);
  302.           return 0;

crypto/evp/digest.c:300:24: 
  298.   #ifndef OPENSSL_NO_ENGINE
  299.       /* Make sure it's safe to copy a digest context using an ENGINE */
  300. >     if (in->engine && !ENGINE_init(in->engine)) {
  301.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);
  302.           return 0;

crypto/engine/eng_init.c:121:1: start of procedure ENGINE_init()
    119.   
    120.   /* The API (locked) version of "init" */
    121. > int ENGINE_init(ENGINE *e)
    122.   {
    123.       int ret;

crypto/engine/eng_init.c:124:9: Taking false branch
    122.   {
    123.       int ret;
    124.       if (e == NULL) {
                   ^
    125.           ENGINEerr(ENGINE_F_ENGINE_INIT, ERR_R_PASSED_NULL_PARAMETER);
    126.           return 0;

crypto/engine/eng_init.c:128:5: 
    126.           return 0;
    127.       }
    128. >     CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
    129.       ret = engine_unlocked_init(e);
    130.       CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);

crypto/lock.c:414:1: start of procedure CRYPTO_lock()
      412.   }
      413.   
      414. > void CRYPTO_lock(int mode, int type, const char *file, int line)
      415.   {
      416.   #ifdef LOCK_DEBUG

crypto/lock.c:441:9: Taking false branch
      439.       }
      440.   #endif
      441.       if (type < 0) {
                     ^
      442.           if (dynlock_lock_callback != NULL) {
      443.               struct CRYPTO_dynlock_value *pointer

crypto/lock.c:452:16: Taking true branch
      450.               CRYPTO_destroy_dynlockid(type);
      451.           }
      452.       } else if (locking_callback != NULL)
                            ^
      453.           locking_callback(mode, type, file, line);
      454.   }

crypto/lock.c:453:9: Skipping __function_pointer__(): unresolved function pointer
      451.           }
      452.       } else if (locking_callback != NULL)
      453.           locking_callback(mode, type, file, line);
                     ^
      454.   }
      455.   

crypto/lock.c:441:5: 
      439.       }
      440.   #endif
      441. >     if (type < 0) {
      442.           if (dynlock_lock_callback != NULL) {
      443.               struct CRYPTO_dynlock_value *pointer

crypto/lock.c:454:1: return from a call to CRYPTO_lock
      452.       } else if (locking_callback != NULL)
      453.           locking_callback(mode, type, file, line);
      454. > }
      455.   
      456.   int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,

crypto/engine/eng_init.c:129:5: 
    127.       }
    128.       CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
    129. >     ret = engine_unlocked_init(e);
    130.       CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
    131.       return ret;

crypto/engine/eng_init.c:61:1: start of procedure engine_unlocked_init()
      59.    * it's already in use). This version is only used internally.
      60.    */
      61. > int engine_unlocked_init(ENGINE *e)
      62.   {
      63.       int to_return = 1;

crypto/engine/eng_init.c:63:5: 
      61.   int engine_unlocked_init(ENGINE *e)
      62.   {
      63. >     int to_return = 1;
      64.   
      65.       if ((e->funct_ref == 0) && e->init)

crypto/engine/eng_init.c:65:10: Taking true branch
      63.       int to_return = 1;
      64.   
      65.       if ((e->funct_ref == 0) && e->init)
                     ^
      66.           /*
      67.            * This is the first functional reference and the engine requires

crypto/engine/eng_init.c:65:32: Taking true branch
      63.       int to_return = 1;
      64.   
      65.       if ((e->funct_ref == 0) && e->init)
                                           ^
      66.           /*
      67.            * This is the first functional reference and the engine requires

crypto/engine/eng_init.c:70:9: Skipping __function_pointer__(): unresolved function pointer
      68.            * initialisation so we do it now.
      69.            */
      70.           to_return = e->init(e);
                    ^
      71.       if (to_return) {
      72.           /*

crypto/engine/eng_init.c:71:9: Taking false branch
      69.            */
      70.           to_return = e->init(e);
      71.       if (to_return) {
                    ^
      72.           /*
      73.            * OK, we return a functional reference which is also a structural

crypto/engine/eng_init.c:81:5: 
      79.           engine_ref_debug(e, 1, 1);
      80.       }
      81. >     return to_return;
      82.   }
      83.   

crypto/engine/eng_init.c:82:1: return from a call to engine_unlocked_init
      80.       }
      81.       return to_return;
      82. > }
      83.   
      84.   /*

crypto/engine/eng_init.c:130:5: 
    128.       CRYPTO_w_lock(CRYPTO_LOCK_ENGINE);
    129.       ret = engine_unlocked_init(e);
    130. >     CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
    131.       return ret;
    132.   }

crypto/lock.c:414:1: start of procedure CRYPTO_lock()
      412.   }
      413.   
      414. > void CRYPTO_lock(int mode, int type, const char *file, int line)
      415.   {
      416.   #ifdef LOCK_DEBUG

crypto/lock.c:441:9: Taking false branch
      439.       }
      440.   #endif
      441.       if (type < 0) {
                     ^
      442.           if (dynlock_lock_callback != NULL) {
      443.               struct CRYPTO_dynlock_value *pointer

crypto/lock.c:452:16: Taking true branch
      450.               CRYPTO_destroy_dynlockid(type);
      451.           }
      452.       } else if (locking_callback != NULL)
                            ^
      453.           locking_callback(mode, type, file, line);
      454.   }

crypto/lock.c:453:9: Skipping __function_pointer__(): unresolved function pointer
      451.           }
      452.       } else if (locking_callback != NULL)
      453.           locking_callback(mode, type, file, line);
                     ^
      454.   }
      455.   

crypto/lock.c:441:5: 
      439.       }
      440.   #endif
      441. >     if (type < 0) {
      442.           if (dynlock_lock_callback != NULL) {
      443.               struct CRYPTO_dynlock_value *pointer

crypto/lock.c:454:1: return from a call to CRYPTO_lock
      452.       } else if (locking_callback != NULL)
      453.           locking_callback(mode, type, file, line);
      454. > }
      455.   
      456.   int CRYPTO_add_lock(int *pointer, int amount, int type, const char *file,

crypto/engine/eng_init.c:131:5: 
    129.       ret = engine_unlocked_init(e);
    130.       CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
    131. >     return ret;
    132.   }
    133.   

crypto/engine/eng_init.c:132:1: return from a call to ENGINE_init
    130.       CRYPTO_w_unlock(CRYPTO_LOCK_ENGINE);
    131.       return ret;
    132. > }
    133.   
    134.   /* The API (locked) version of "finish" */

crypto/evp/digest.c:300:24: Taking true branch
  298.   #ifndef OPENSSL_NO_ENGINE
  299.       /* Make sure it's safe to copy a digest context using an ENGINE */
  300.       if (in->engine && !ENGINE_init(in->engine)) {
                                ^
  301.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);
  302.           return 0;

crypto/evp/digest.c:301:9: Skipping ERR_put_error(): empty list of specs
  299.       /* Make sure it's safe to copy a digest context using an ENGINE */
  300.       if (in->engine && !ENGINE_init(in->engine)) {
  301.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);
                 ^
  302.           return 0;
  303.       }

crypto/evp/digest.c:302:9: 
  300.       if (in->engine && !ENGINE_init(in->engine)) {
  301.           EVPerr(EVP_F_EVP_MD_CTX_COPY_EX, ERR_R_ENGINE_LIB);
  302. >         return 0;
  303.       }
  304.   #endif

crypto/evp/digest.c:348:1: return from a call to EVP_MD_CTX_copy_ex
  346.   
  347.       return 1;
  348. > }
  349.   
  350.   int EVP_Digest(const void *data, size_t count,

crypto/evp/p_sign.c:86:13: Taking false branch
84.           }
85.           rv = EVP_MD_CTX_copy_ex(tmp_ctx, ctx);
86.           if (rv)
                  ^
87.               rv = EVP_DigestFinal_ex(tmp_ctx, m, &m_len);
88.           EVP_MD_CTX_free(tmp_ctx);

crypto/evp/p_sign.c:88:9: 
86.           if (rv)
87.               rv = EVP_DigestFinal_ex(tmp_ctx, m, &m_len);
88. >         EVP_MD_CTX_free(tmp_ctx);
89.           if (!rv)
90.               return 0;

crypto/evp/digest.c:157:1: start of procedure EVP_MD_CTX_free()
  155.   }
  156.   
  157. > void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  158.   {
  159.       EVP_MD_CTX_reset(ctx);

crypto/evp/digest.c:159:5: Skipping EVP_MD_CTX_reset(): empty list of specs
  157.   void EVP_MD_CTX_free(EVP_MD_CTX *ctx)
  158.   {
  159.       EVP_MD_CTX_reset(ctx);
             ^
  160.       OPENSSL_free(ctx);
  161.   }

crypto/evp/digest.c:160:5: 
  158.   {
  159.       EVP_MD_CTX_reset(ctx);
  160. >     OPENSSL_free(ctx);
  161.   }
  162.   

crypto/mem.c:222:1: start of procedure CRYPTO_free()
    220.   }
    221.   
    222. > void CRYPTO_free(void *str, const char *file, int line)
    223.   {
    224.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:224:9: Taking true branch
    222.   void CRYPTO_free(void *str, const char *file, int line)
    223.   {
    224.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                   ^
    225.           free_impl(str, file, line);
    226.           return;

crypto/mem.c:224:30: Taking true branch
    222.   void CRYPTO_free(void *str, const char *file, int line)
    223.   {
    224.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                        ^
    225.           free_impl(str, file, line);
    226.           return;

crypto/mem.c:225:9: Skipping __function_pointer__(): unresolved function pointer
    223.   {
    224.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    225.           free_impl(str, file, line);
                   ^
    226.           return;
    227.       }

crypto/mem.c:226:9: 
    224.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
    225.           free_impl(str, file, line);
    226. >         return;
    227.       }
    228.   

crypto/mem.c:240:1: return from a call to CRYPTO_free
    238.       free(str);
    239.   #endif
    240. > }
    241.   
    242.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/evp/digest.c:161:1: return from a call to EVP_MD_CTX_free
  159.       EVP_MD_CTX_reset(ctx);
  160.       OPENSSL_free(ctx);
  161. > }
  162.   
  163.   int EVP_DigestInit(EVP_MD_CTX *ctx, const EVP_MD *type)
