crypto/bn/bn_mont.c:523: error: MEMORY_LEAK
  memory dynamically allocated by call to `BN_MONT_CTX_new()` at line 519, column 11 is not reachable after line 523, column 9.
Showing all 45 steps of the trace


crypto/bn/bn_mont.c:500:1: start of procedure BN_MONT_CTX_set_locked()
498.   }
499.   
500. > BN_MONT_CTX *BN_MONT_CTX_set_locked(BN_MONT_CTX **pmont, int lock,
501.                                       const BIGNUM *mod, BN_CTX *ctx)
502.   {

crypto/bn/bn_mont.c:505:5: 
503.       BN_MONT_CTX *ret;
504.   
505. >     CRYPTO_r_lock(lock);
506.       ret = *pmont;
507.       CRYPTO_r_unlock(lock);

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/bn/bn_mont.c:506:5: 
504.   
505.       CRYPTO_r_lock(lock);
506. >     ret = *pmont;
507.       CRYPTO_r_unlock(lock);
508.       if (ret)

crypto/bn/bn_mont.c:507:5: 
505.       CRYPTO_r_lock(lock);
506.       ret = *pmont;
507. >     CRYPTO_r_unlock(lock);
508.       if (ret)
509.           return ret;

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/bn/bn_mont.c:508:9: Taking false branch
506.       ret = *pmont;
507.       CRYPTO_r_unlock(lock);
508.       if (ret)
               ^
509.           return ret;
510.   

crypto/bn/bn_mont.c:519:5: 
517.        * (the losers throw away the work they've done).
518.        */
519. >     ret = BN_MONT_CTX_new();
520.       if (ret == NULL)
521.           return NULL;

crypto/bn/bn_mont.c:315:1: start of procedure BN_MONT_CTX_new()
  313.   }
  314.   
  315. > BN_MONT_CTX *BN_MONT_CTX_new(void)
  316.   {
  317.       BN_MONT_CTX *ret;

crypto/bn/bn_mont.c:319:9: 
  317.       BN_MONT_CTX *ret;
  318.   
  319. >     if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)
  320.           return (NULL);
  321.   

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

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

crypto/mem.c:124:9: Taking false branch
    122.       void *ret = NULL;
    123.   
    124.       if (num <= 0)
                   ^
    125.           return NULL;
    126.   

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

crypto/mem.c:137:5: 
    135.       }
    136.   #else
    137. >     (void)file;
    138.       (void)line;
    139.       ret = malloc(num);

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

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

crypto/mem.c:154:5: 
    152.   #endif
    153.   
    154. >     return ret;
    155.   }
    156.   

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

crypto/bn/bn_mont.c:319:9: Taking false branch
  317.       BN_MONT_CTX *ret;
  318.   
  319.       if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)
                 ^
  320.           return (NULL);
  321.   

crypto/bn/bn_mont.c:322:5: 
  320.           return (NULL);
  321.   
  322. >     BN_MONT_CTX_init(ret);
  323.       ret->flags = BN_FLG_MALLOCED;
  324.       return (ret);

crypto/bn/bn_mont.c:327:1: start of procedure BN_MONT_CTX_init()
    325.   }
    326.   
    327. > void BN_MONT_CTX_init(BN_MONT_CTX *ctx)
    328.   {
    329.       ctx->ri = 0;

crypto/bn/bn_mont.c:329:5: 
    327.   void BN_MONT_CTX_init(BN_MONT_CTX *ctx)
    328.   {
    329. >     ctx->ri = 0;
    330.       bn_init(&(ctx->RR));
    331.       bn_init(&(ctx->N));

crypto/bn/bn_mont.c:330:5: Skipping bn_init(): empty list of specs
    328.   {
    329.       ctx->ri = 0;
    330.       bn_init(&(ctx->RR));
               ^
    331.       bn_init(&(ctx->N));
    332.       bn_init(&(ctx->Ni));

crypto/bn/bn_mont.c:331:5: Skipping bn_init(): empty list of specs
    329.       ctx->ri = 0;
    330.       bn_init(&(ctx->RR));
    331.       bn_init(&(ctx->N));
               ^
    332.       bn_init(&(ctx->Ni));
    333.       ctx->n0[0] = ctx->n0[1] = 0;

crypto/bn/bn_mont.c:332:5: Skipping bn_init(): empty list of specs
    330.       bn_init(&(ctx->RR));
    331.       bn_init(&(ctx->N));
    332.       bn_init(&(ctx->Ni));
               ^
    333.       ctx->n0[0] = ctx->n0[1] = 0;
    334.       ctx->flags = 0;

crypto/bn/bn_mont.c:333:5: 
    331.       bn_init(&(ctx->N));
    332.       bn_init(&(ctx->Ni));
    333. >     ctx->n0[0] = ctx->n0[1] = 0;
    334.       ctx->flags = 0;
    335.   }

crypto/bn/bn_mont.c:334:5: 
    332.       bn_init(&(ctx->Ni));
    333.       ctx->n0[0] = ctx->n0[1] = 0;
    334. >     ctx->flags = 0;
    335.   }
    336.   

crypto/bn/bn_mont.c:335:1: return from a call to BN_MONT_CTX_init
    333.       ctx->n0[0] = ctx->n0[1] = 0;
    334.       ctx->flags = 0;
    335. > }
    336.   
    337.   void BN_MONT_CTX_free(BN_MONT_CTX *mont)

crypto/bn/bn_mont.c:323:5: 
  321.   
  322.       BN_MONT_CTX_init(ret);
  323. >     ret->flags = BN_FLG_MALLOCED;
  324.       return (ret);
  325.   }

crypto/bn/bn_mont.c:324:5: 
  322.       BN_MONT_CTX_init(ret);
  323.       ret->flags = BN_FLG_MALLOCED;
  324. >     return (ret);
  325.   }
  326.   

crypto/bn/bn_mont.c:325:1: return from a call to BN_MONT_CTX_new
  323.       ret->flags = BN_FLG_MALLOCED;
  324.       return (ret);
  325. > }
  326.   
  327.   void BN_MONT_CTX_init(BN_MONT_CTX *ctx)

crypto/bn/bn_mont.c:520:9: Taking false branch
518.        */
519.       ret = BN_MONT_CTX_new();
520.       if (ret == NULL)
               ^
521.           return NULL;
522.       if (!BN_MONT_CTX_set(ret, mod, ctx)) {

crypto/bn/bn_mont.c:522:10: Taking true branch
520.       if (ret == NULL)
521.           return NULL;
522.       if (!BN_MONT_CTX_set(ret, mod, ctx)) {
                ^
523.           BN_MONT_CTX_free(ret);
524.           return NULL;

crypto/bn/bn_mont.c:523:9: Skipping BN_MONT_CTX_free(): empty list of specs
521.           return NULL;
522.       if (!BN_MONT_CTX_set(ret, mod, ctx)) {
523.           BN_MONT_CTX_free(ret);
               ^
524.           return NULL;
525.       }
