crypto/ec/ec2_mult.c:97: error: MEMORY_LEAK
  memory dynamically allocated by call to `BN_CTX_start()` at line 92, column 5 is not reachable after line 97, column 10.
Showing all 56 steps of the trace


crypto/ec/ec2_mult.c:85:1: start of procedure gf2m_Mdouble()
83.    * modified to not require precomputation of c=b^{2^{m-1}}.
84.    */
85. > static int gf2m_Mdouble(const EC_GROUP *group, BIGNUM *x, BIGNUM *z,
86.                           BN_CTX *ctx)
87.   {

crypto/ec/ec2_mult.c:89:5: 
87.   {
88.       BIGNUM *t1;
89. >     int ret = 0;
90.   
91.       /* Since Mdouble is static we can guarantee that ctx != NULL. */

crypto/ec/ec2_mult.c:92:5: 
90.   
91.       /* Since Mdouble is static we can guarantee that ctx != NULL. */
92. >     BN_CTX_start(ctx);
93.       t1 = BN_CTX_get(ctx);
94.       if (t1 == NULL)

crypto/bn/bn_ctx.c:236:1: start of procedure BN_CTX_start()
  234.   }
  235.   
  236. > void BN_CTX_start(BN_CTX *ctx)
  237.   {
  238.       CTXDBG_ENTRY("BN_CTX_start", ctx);

crypto/bn/bn_ctx.c:240:9: Taking false branch
  238.       CTXDBG_ENTRY("BN_CTX_start", ctx);
  239.       /* If we're already overflowing ... */
  240.       if (ctx->err_stack || ctx->too_many)
                 ^
  241.           ctx->err_stack++;
  242.       /* (Try to) get a new frame pointer */

crypto/bn/bn_ctx.c:240:27: Taking false branch
  238.       CTXDBG_ENTRY("BN_CTX_start", ctx);
  239.       /* If we're already overflowing ... */
  240.       if (ctx->err_stack || ctx->too_many)
                                   ^
  241.           ctx->err_stack++;
  242.       /* (Try to) get a new frame pointer */

crypto/bn/bn_ctx.c:243:15: 
  241.           ctx->err_stack++;
  242.       /* (Try to) get a new frame pointer */
  243. >     else if (!BN_STACK_push(&ctx->stack, ctx->used)) {
  244.           BNerr(BN_F_BN_CTX_START, BN_R_TOO_MANY_TEMPORARY_VARIABLES);
  245.           ctx->err_stack++;

crypto/bn/bn_ctx.c:307:1: start of procedure BN_STACK_push()
    305.   
    306.   
    307. > static int BN_STACK_push(BN_STACK *st, unsigned int idx)
    308.   {
    309.       if (st->depth == st->size) {

crypto/bn/bn_ctx.c:309:9: Taking true branch
    307.   static int BN_STACK_push(BN_STACK *st, unsigned int idx)
    308.   {
    309.       if (st->depth == st->size) {
                   ^
    310.           /* Need to expand */
    311.           unsigned int newsize =

crypto/bn/bn_ctx.c:312:13: Condition is true
    310.           /* Need to expand */
    311.           unsigned int newsize =
    312.               st->size ? (st->size * 3 / 2) : BN_CTX_START_FRAMES;
                       ^
    313.           unsigned int *newitems = OPENSSL_malloc(sizeof(*newitems) * newsize);
    314.           if (newitems == NULL)

crypto/bn/bn_ctx.c:311:9: 
    309.       if (st->depth == st->size) {
    310.           /* Need to expand */
    311. >         unsigned int newsize =
    312.               st->size ? (st->size * 3 / 2) : BN_CTX_START_FRAMES;
    313.           unsigned int *newitems = OPENSSL_malloc(sizeof(*newitems) * newsize);

crypto/bn/bn_ctx.c:313:9: 
    311.           unsigned int newsize =
    312.               st->size ? (st->size * 3 / 2) : BN_CTX_START_FRAMES;
    313. >         unsigned int *newitems = OPENSSL_malloc(sizeof(*newitems) * newsize);
    314.           if (newitems == NULL)
    315.               return 0;

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_ctx.c:314:13: Taking false branch
    312.               st->size ? (st->size * 3 / 2) : BN_CTX_START_FRAMES;
    313.           unsigned int *newitems = OPENSSL_malloc(sizeof(*newitems) * newsize);
    314.           if (newitems == NULL)
                       ^
    315.               return 0;
    316.           if (st->depth)

crypto/bn/bn_ctx.c:316:13: Taking true branch
    314.           if (newitems == NULL)
    315.               return 0;
    316.           if (st->depth)
                       ^
    317.               memcpy(newitems, st->indexes, sizeof(*newitems) * st->depth);
    318.           OPENSSL_free(st->indexes);

crypto/bn/bn_ctx.c:317:13: 
    315.               return 0;
    316.           if (st->depth)
    317. >             memcpy(newitems, st->indexes, sizeof(*newitems) * st->depth);
    318.           OPENSSL_free(st->indexes);
    319.           st->indexes = newitems;

crypto/bn/bn_ctx.c:318:9: 
    316.           if (st->depth)
    317.               memcpy(newitems, st->indexes, sizeof(*newitems) * st->depth);
    318. >         OPENSSL_free(st->indexes);
    319.           st->indexes = newitems;
    320.           st->size = newsize;

crypto/mem.c:234:1: start of procedure CRYPTO_free()
      232.   }
      233.   
      234. > void CRYPTO_free(void *str)
      235.   {
      236.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG

crypto/mem.c:245:5: 
      243.       }
      244.   #else
      245. >     free(str);
      246.   #endif
      247.   }

crypto/mem.c:247:1: return from a call to CRYPTO_free
      245.       free(str);
      246.   #endif
      247. > }
      248.   
      249.   void CRYPTO_clear_free(void *str, size_t num)

crypto/bn/bn_ctx.c:319:9: 
    317.               memcpy(newitems, st->indexes, sizeof(*newitems) * st->depth);
    318.           OPENSSL_free(st->indexes);
    319. >         st->indexes = newitems;
    320.           st->size = newsize;
    321.       }

crypto/bn/bn_ctx.c:320:9: 
    318.           OPENSSL_free(st->indexes);
    319.           st->indexes = newitems;
    320. >         st->size = newsize;
    321.       }
    322.       st->indexes[(st->depth)++] = idx;

crypto/bn/bn_ctx.c:322:5: 
    320.           st->size = newsize;
    321.       }
    322. >     st->indexes[(st->depth)++] = idx;
    323.       return 1;
    324.   }

crypto/bn/bn_ctx.c:323:5: 
    321.       }
    322.       st->indexes[(st->depth)++] = idx;
    323. >     return 1;
    324.   }
    325.   

crypto/bn/bn_ctx.c:324:1: return from a call to BN_STACK_push
    322.       st->indexes[(st->depth)++] = idx;
    323.       return 1;
    324. > }
    325.   
    326.   static unsigned int BN_STACK_pop(BN_STACK *st)

crypto/bn/bn_ctx.c:243:15: Taking false branch
  241.           ctx->err_stack++;
  242.       /* (Try to) get a new frame pointer */
  243.       else if (!BN_STACK_push(&ctx->stack, ctx->used)) {
                       ^
  244.           BNerr(BN_F_BN_CTX_START, BN_R_TOO_MANY_TEMPORARY_VARIABLES);
  245.           ctx->err_stack++;

crypto/bn/bn_ctx.c:240:5: 
  238.       CTXDBG_ENTRY("BN_CTX_start", ctx);
  239.       /* If we're already overflowing ... */
  240. >     if (ctx->err_stack || ctx->too_many)
  241.           ctx->err_stack++;
  242.       /* (Try to) get a new frame pointer */

crypto/bn/bn_ctx.c:248:1: return from a call to BN_CTX_start
  246.       }
  247.       CTXDBG_EXIT(ctx);
  248. > }
  249.   
  250.   void BN_CTX_end(BN_CTX *ctx)

crypto/ec/ec2_mult.c:93:5: 
91.       /* Since Mdouble is static we can guarantee that ctx != NULL. */
92.       BN_CTX_start(ctx);
93. >     t1 = BN_CTX_get(ctx);
94.       if (t1 == NULL)
95.           goto err;

crypto/bn/bn_ctx.c:267:1: start of procedure BN_CTX_get()
  265.   }
  266.   
  267. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
  268.   {
  269.       BIGNUM *ret;

crypto/bn/bn_ctx.c:272:9: Taking false branch
  270.   
  271.       CTXDBG_ENTRY("BN_CTX_get", ctx);
  272.       if (ctx->err_stack || ctx->too_many)
                 ^
  273.           return NULL;
  274.       if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) {

crypto/bn/bn_ctx.c:272:27: Taking false branch
  270.   
  271.       CTXDBG_ENTRY("BN_CTX_get", ctx);
  272.       if (ctx->err_stack || ctx->too_many)
                                   ^
  273.           return NULL;
  274.       if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) {

crypto/bn/bn_ctx.c:274:9: Taking false branch
  272.       if (ctx->err_stack || ctx->too_many)
  273.           return NULL;
  274.       if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) {
                 ^
  275.           /*
  276.            * Setting too_many prevents repeated "get" attempts from cluttering

crypto/bn/bn_ctx.c:284:5: 
  282.       }
  283.       /* OK, make sure the returned bignum is "zero" */
  284. >     BN_zero(ret);
  285.       ctx->used++;
  286.       CTXDBG_RET(ctx, ret);

crypto/bn/bn_lib.c:530:1: start of procedure BN_set_word()
    528.   }
    529.   
    530. > int BN_set_word(BIGNUM *a, BN_ULONG w)
    531.   {
    532.       bn_check_top(a);

crypto/bn/bn_lib.c:533:9: Condition is true
    531.   {
    532.       bn_check_top(a);
    533.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
                   ^
    534.           return (0);
    535.       a->neg = 0;

crypto/bn/bn_lib.c:533:9: Taking false branch
    531.   {
    532.       bn_check_top(a);
    533.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
                   ^
    534.           return (0);
    535.       a->neg = 0;

crypto/bn/bn_lib.c:535:5: 
    533.       if (bn_expand(a, (int)sizeof(BN_ULONG) * 8) == NULL)
    534.           return (0);
    535. >     a->neg = 0;
    536.       a->d[0] = w;
    537.       a->top = (w ? 1 : 0);

crypto/bn/bn_lib.c:536:5: 
    534.           return (0);
    535.       a->neg = 0;
    536. >     a->d[0] = w;
    537.       a->top = (w ? 1 : 0);
    538.       bn_check_top(a);

crypto/bn/bn_lib.c:537:15: Condition is false
    535.       a->neg = 0;
    536.       a->d[0] = w;
    537.       a->top = (w ? 1 : 0);
                         ^
    538.       bn_check_top(a);
    539.       return (1);

crypto/bn/bn_lib.c:537:5: 
    535.       a->neg = 0;
    536.       a->d[0] = w;
    537. >     a->top = (w ? 1 : 0);
    538.       bn_check_top(a);
    539.       return (1);

crypto/bn/bn_lib.c:539:5: 
    537.       a->top = (w ? 1 : 0);
    538.       bn_check_top(a);
    539. >     return (1);
    540.   }
    541.   

crypto/bn/bn_lib.c:540:1: return from a call to BN_set_word
    538.       bn_check_top(a);
    539.       return (1);
    540. > }
    541.   
    542.   BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)

crypto/bn/bn_ctx.c:285:5: 
  283.       /* OK, make sure the returned bignum is "zero" */
  284.       BN_zero(ret);
  285. >     ctx->used++;
  286.       CTXDBG_RET(ctx, ret);
  287.       return ret;

crypto/bn/bn_ctx.c:287:5: 
  285.       ctx->used++;
  286.       CTXDBG_RET(ctx, ret);
  287. >     return ret;
  288.   }
  289.   

crypto/bn/bn_ctx.c:288:1: return from a call to BN_CTX_get
  286.       CTXDBG_RET(ctx, ret);
  287.       return ret;
  288. > }
  289.   
  290.   /************/

crypto/ec/ec2_mult.c:94:9: Taking false branch
92.       BN_CTX_start(ctx);
93.       t1 = BN_CTX_get(ctx);
94.       if (t1 == NULL)
              ^
95.           goto err;
96.   

crypto/ec/ec2_mult.c:97:10: Skipping __function_pointer__(): unresolved function pointer
95.           goto err;
96.   
97.       if (!group->meth->field_sqr(group, x, x, ctx))
                ^
98.           goto err;
99.       if (!group->meth->field_sqr(group, t1, z, ctx))
