crypto/ec/ec_lib.c:1004: error: MEMORY_LEAK
  memory dynamically allocated to `group->mont_data` by call to `BN_MONT_CTX_new()` at line 998, column 24 is not reachable after line 1004, column 9.
Showing all 66 steps of the trace


crypto/ec/ec_lib.c:987:1: start of procedure ec_precompute_mont_data()
985.    * returns one on success. On error it returns zero.
986.    */
987. > int ec_precompute_mont_data(EC_GROUP *group)
988.   {
989.       BN_CTX *ctx = BN_CTX_new();

crypto/ec/ec_lib.c:989:5: Skipping BN_CTX_new(): empty list of specs
987.   int ec_precompute_mont_data(EC_GROUP *group)
988.   {
989.       BN_CTX *ctx = BN_CTX_new();
           ^
990.       int ret = 0;
991.   

crypto/ec/ec_lib.c:990:5: 
988.   {
989.       BN_CTX *ctx = BN_CTX_new();
990. >     int ret = 0;
991.   
992.       BN_MONT_CTX_free(group->mont_data);

crypto/ec/ec_lib.c:992:5: Skipping BN_MONT_CTX_free(): empty list of specs
990.       int ret = 0;
991.   
992.       BN_MONT_CTX_free(group->mont_data);
           ^
993.       group->mont_data = NULL;
994.   

crypto/ec/ec_lib.c:993:5: 
991.   
992.       BN_MONT_CTX_free(group->mont_data);
993. >     group->mont_data = NULL;
994.   
995.       if (ctx == NULL)

crypto/ec/ec_lib.c:995:9: Taking false branch
993.       group->mont_data = NULL;
994.   
995.       if (ctx == NULL)
               ^
996.           goto err;
997.   

crypto/ec/ec_lib.c:998:5: 
996.           goto err;
997.   
998. >     group->mont_data = BN_MONT_CTX_new();
999.       if (group->mont_data == NULL)
1000.           goto err;

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

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

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/bn/bn_mont.c:318:9: Taking false branch
  316.       BN_MONT_CTX *ret;
  317.   
  318.       if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)
                 ^
  319.           return (NULL);
  320.   

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

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

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

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

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

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

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

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

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

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

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

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

crypto/ec/ec_lib.c:999:9: Taking false branch
997.   
998.       group->mont_data = BN_MONT_CTX_new();
999.       if (group->mont_data == NULL)
                ^
1000.           goto err;
1001.   

crypto/ec/ec_lib.c:1002:10: 
1000.           goto err;
1001.   
1002. >     if (!BN_MONT_CTX_set(group->mont_data, group->order, ctx)) {
1003.           BN_MONT_CTX_free(group->mont_data);
1004.           group->mont_data = NULL;

crypto/bn/bn_mont.c:348:1: start of procedure BN_MONT_CTX_set()
  346.   }
  347.   
  348. > int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
  349.   {
  350.       int ret = 0;

crypto/bn/bn_mont.c:350:5: 
  348.   int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)
  349.   {
  350. >     int ret = 0;
  351.       BIGNUM *Ri, *R;
  352.   

crypto/bn/bn_mont.c:353:9: 
  351.       BIGNUM *Ri, *R;
  352.   
  353. >     if (BN_is_zero(mod))
  354.           return 0;
  355.   

crypto/bn/bn_lib.c:975:1: start of procedure BN_is_zero()
    973.   }
    974.   
    975. > int BN_is_zero(const BIGNUM *a)
    976.   {
    977.       return a->top == 0;

crypto/bn/bn_lib.c:977:12: Condition is false
    975.   int BN_is_zero(const BIGNUM *a)
    976.   {
    977.       return a->top == 0;
                      ^
    978.   }
    979.   

crypto/bn/bn_lib.c:977:5: 
    975.   int BN_is_zero(const BIGNUM *a)
    976.   {
    977. >     return a->top == 0;
    978.   }
    979.   

crypto/bn/bn_lib.c:978:1: return from a call to BN_is_zero
    976.   {
    977.       return a->top == 0;
    978. > }
    979.   
    980.   int BN_is_one(const BIGNUM *a)

crypto/bn/bn_mont.c:353:9: Taking false branch
  351.       BIGNUM *Ri, *R;
  352.   
  353.       if (BN_is_zero(mod))
                 ^
  354.           return 0;
  355.   

crypto/bn/bn_mont.c:356:5: 
  354.           return 0;
  355.   
  356. >     BN_CTX_start(ctx);
  357.       if ((Ri = BN_CTX_get(ctx)) == NULL)
  358.           goto err;

crypto/bn/bn_ctx.c:227:1: start of procedure BN_CTX_start()
    225.   }
    226.   
    227. > void BN_CTX_start(BN_CTX *ctx)
    228.   {
    229.       CTXDBG_ENTRY("BN_CTX_start", ctx);

crypto/bn/bn_ctx.c:231:9: Taking true branch
    229.       CTXDBG_ENTRY("BN_CTX_start", ctx);
    230.       /* If we're already overflowing ... */
    231.       if (ctx->err_stack || ctx->too_many)
                   ^
    232.           ctx->err_stack++;
    233.       /* (Try to) get a new frame pointer */

crypto/bn/bn_ctx.c:232:9: 
    230.       /* If we're already overflowing ... */
    231.       if (ctx->err_stack || ctx->too_many)
    232. >         ctx->err_stack++;
    233.       /* (Try to) get a new frame pointer */
    234.       else if (!BN_STACK_push(&ctx->stack, ctx->used)) {

crypto/bn/bn_ctx.c:231:5: 
    229.       CTXDBG_ENTRY("BN_CTX_start", ctx);
    230.       /* If we're already overflowing ... */
    231. >     if (ctx->err_stack || ctx->too_many)
    232.           ctx->err_stack++;
    233.       /* (Try to) get a new frame pointer */

crypto/bn/bn_ctx.c:239:1: return from a call to BN_CTX_start
    237.       }
    238.       CTXDBG_EXIT(ctx);
    239. > }
    240.   
    241.   void BN_CTX_end(BN_CTX *ctx)

crypto/bn/bn_mont.c:357:9: 
  355.   
  356.       BN_CTX_start(ctx);
  357. >     if ((Ri = BN_CTX_get(ctx)) == NULL)
  358.           goto err;
  359.       R = &(mont->RR);            /* grab RR as a temp */

crypto/bn/bn_ctx.c:258:1: start of procedure BN_CTX_get()
    256.   }
    257.   
    258. > BIGNUM *BN_CTX_get(BN_CTX *ctx)
    259.   {
    260.       BIGNUM *ret;

crypto/bn/bn_ctx.c:263:9: Taking true branch
    261.   
    262.       CTXDBG_ENTRY("BN_CTX_get", ctx);
    263.       if (ctx->err_stack || ctx->too_many)
                   ^
    264.           return NULL;
    265.       if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) {

crypto/bn/bn_ctx.c:264:9: 
    262.       CTXDBG_ENTRY("BN_CTX_get", ctx);
    263.       if (ctx->err_stack || ctx->too_many)
    264. >         return NULL;
    265.       if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) {
    266.           /*

crypto/bn/bn_ctx.c:279:1: return from a call to BN_CTX_get
    277.       CTXDBG_RET(ctx, ret);
    278.       return ret;
    279. > }
    280.   
    281.   /************/

crypto/bn/bn_mont.c:357:9: Taking true branch
  355.   
  356.       BN_CTX_start(ctx);
  357.       if ((Ri = BN_CTX_get(ctx)) == NULL)
                 ^
  358.           goto err;
  359.       R = &(mont->RR);            /* grab RR as a temp */

crypto/bn/bn_mont.c:477:2: 
  475.   
  476.       ret = 1;
  477. >  err:
  478.       BN_CTX_end(ctx);
  479.       return ret;

crypto/bn/bn_mont.c:478:5: 
  476.       ret = 1;
  477.    err:
  478. >     BN_CTX_end(ctx);
  479.       return ret;
  480.   }

crypto/bn/bn_ctx.c:241:1: start of procedure BN_CTX_end()
    239.   }
    240.   
    241. > void BN_CTX_end(BN_CTX *ctx)
    242.   {
    243.       CTXDBG_ENTRY("BN_CTX_end", ctx);

crypto/bn/bn_ctx.c:244:9: Taking true branch
    242.   {
    243.       CTXDBG_ENTRY("BN_CTX_end", ctx);
    244.       if (ctx->err_stack)
                   ^
    245.           ctx->err_stack--;
    246.       else {

crypto/bn/bn_ctx.c:245:9: 
    243.       CTXDBG_ENTRY("BN_CTX_end", ctx);
    244.       if (ctx->err_stack)
    245. >         ctx->err_stack--;
    246.       else {
    247.           unsigned int fp = BN_STACK_pop(&ctx->stack);

crypto/bn/bn_ctx.c:244:5: 
    242.   {
    243.       CTXDBG_ENTRY("BN_CTX_end", ctx);
    244. >     if (ctx->err_stack)
    245.           ctx->err_stack--;
    246.       else {

crypto/bn/bn_ctx.c:256:1: return from a call to BN_CTX_end
    254.       }
    255.       CTXDBG_EXIT(ctx);
    256. > }
    257.   
    258.   BIGNUM *BN_CTX_get(BN_CTX *ctx)

crypto/bn/bn_mont.c:479:5: 
  477.    err:
  478.       BN_CTX_end(ctx);
  479. >     return ret;
  480.   }
  481.   

crypto/bn/bn_mont.c:480:1: return from a call to BN_MONT_CTX_set
  478.       BN_CTX_end(ctx);
  479.       return ret;
  480. > }
  481.   
  482.   BN_MONT_CTX *BN_MONT_CTX_copy(BN_MONT_CTX *to, BN_MONT_CTX *from)

crypto/ec/ec_lib.c:1002:10: Taking true branch
1000.           goto err;
1001.   
1002.       if (!BN_MONT_CTX_set(group->mont_data, group->order, ctx)) {
                 ^
1003.           BN_MONT_CTX_free(group->mont_data);
1004.           group->mont_data = NULL;

crypto/ec/ec_lib.c:1003:9: Skipping BN_MONT_CTX_free(): empty list of specs
1001.   
1002.       if (!BN_MONT_CTX_set(group->mont_data, group->order, ctx)) {
1003.           BN_MONT_CTX_free(group->mont_data);
                ^
1004.           group->mont_data = NULL;
1005.           goto err;

crypto/ec/ec_lib.c:1004:9: 
1002.       if (!BN_MONT_CTX_set(group->mont_data, group->order, ctx)) {
1003.           BN_MONT_CTX_free(group->mont_data);
1004. >         group->mont_data = NULL;
1005.           goto err;
1006.       }

int ec_precompute_mont_data(EC_GROUP *group)
{
    BN_CTX *ctx = BN_CTX_new();
    int ret = 0;
    BN_MONT_CTX_free(group->mont_data);
    group->mont_data = NULL;
    if (ctx == NULL)
        goto err;
    group->mont_data = BN_MONT_CTX_new();
    if (group->mont_data == NULL)
        goto err;
    if (!BN_MONT_CTX_set(group->mont_data, group->order, ctx)) {
        BN_MONT_CTX_free(group->mont_data);
        group->mont_data = NULL;
        goto err;
    }
    ret = 1;
 err:
    BN_CTX_free(ctx);
    return ret;
}
['int ec_precompute_mont_data(EC_GROUP *group)\n{\n    BN_CTX *ctx = BN_CTX_new();\n    int ret = 0;\n    BN_MONT_CTX_free(group->mont_data);\n    group->mont_data = NULL;\n    if (ctx == NULL)\n        goto err;\n    group->mont_data = BN_MONT_CTX_new();\n    if (group->mont_data == NULL)\n        goto err;\n    if (!BN_MONT_CTX_set(group->mont_data, group->order, ctx)) {\n        BN_MONT_CTX_free(group->mont_data);\n        group->mont_data = NULL;\n        goto err;\n    }\n    ret = 1;\n err:\n    BN_CTX_free(ctx);\n    return ret;\n}', 'BN_MONT_CTX *BN_MONT_CTX_new(void)\n{\n    BN_MONT_CTX *ret;\n    if ((ret = OPENSSL_malloc(sizeof(*ret))) == NULL)\n        return (NULL);\n    BN_MONT_CTX_init(ret);\n    ret->flags = BN_FLG_MALLOCED;\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#ifndef OPENSSL_CPUID_OBJ\n    if (ret && (num > 2048)) {\n        extern unsigned char cleanse_ctr;\n        ((unsigned char *)ret)[0] = cleanse_ctr;\n    }\n#endif\n    return ret;\n}', 'void BN_MONT_CTX_init(BN_MONT_CTX *ctx)\n{\n    ctx->ri = 0;\n    bn_init(&(ctx->RR));\n    bn_init(&(ctx->N));\n    bn_init(&(ctx->Ni));\n    ctx->n0[0] = ctx->n0[1] = 0;\n    ctx->flags = 0;\n}', 'int BN_MONT_CTX_set(BN_MONT_CTX *mont, const BIGNUM *mod, BN_CTX *ctx)\n{\n    int ret = 0;\n    BIGNUM *Ri, *R;\n    if (BN_is_zero(mod))\n        return 0;\n    BN_CTX_start(ctx);\n    if ((Ri = BN_CTX_get(ctx)) == NULL)\n        goto err;\n    R = &(mont->RR);\n    if (!BN_copy(&(mont->N), mod))\n        goto err;\n    mont->N.neg = 0;\n#ifdef MONT_WORD\n    {\n        BIGNUM tmod;\n        BN_ULONG buf[2];\n        bn_init(&tmod);\n        tmod.d = buf;\n        tmod.dmax = 2;\n        tmod.neg = 0;\n        mont->ri = (BN_num_bits(mod) + (BN_BITS2 - 1)) / BN_BITS2 * BN_BITS2;\n# if defined(OPENSSL_BN_ASM_MONT) && (BN_BITS2<=32)\n        BN_zero(R);\n        if (!(BN_set_bit(R, 2 * BN_BITS2)))\n            goto err;\n        tmod.top = 0;\n        if ((buf[0] = mod->d[0]))\n            tmod.top = 1;\n        if ((buf[1] = mod->top > 1 ? mod->d[1] : 0))\n            tmod.top = 2;\n        if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL)\n            goto err;\n        if (!BN_lshift(Ri, Ri, 2 * BN_BITS2))\n            goto err;\n        if (!BN_is_zero(Ri)) {\n            if (!BN_sub_word(Ri, 1))\n                goto err;\n        } else {\n            if (bn_expand(Ri, (int)sizeof(BN_ULONG) * 2) == NULL)\n                goto err;\n            Ri->neg = 0;\n            Ri->d[0] = BN_MASK2;\n            Ri->d[1] = BN_MASK2;\n            Ri->top = 2;\n        }\n        if (!BN_div(Ri, NULL, Ri, &tmod, ctx))\n            goto err;\n        mont->n0[0] = (Ri->top > 0) ? Ri->d[0] : 0;\n        mont->n0[1] = (Ri->top > 1) ? Ri->d[1] : 0;\n# else\n        BN_zero(R);\n        if (!(BN_set_bit(R, BN_BITS2)))\n            goto err;\n        buf[0] = mod->d[0];\n        buf[1] = 0;\n        tmod.top = buf[0] != 0 ? 1 : 0;\n        if ((BN_mod_inverse(Ri, R, &tmod, ctx)) == NULL)\n            goto err;\n        if (!BN_lshift(Ri, Ri, BN_BITS2))\n            goto err;\n        if (!BN_is_zero(Ri)) {\n            if (!BN_sub_word(Ri, 1))\n                goto err;\n        } else {\n            if (!BN_set_word(Ri, BN_MASK2))\n                goto err;\n        }\n        if (!BN_div(Ri, NULL, Ri, &tmod, ctx))\n            goto err;\n        mont->n0[0] = (Ri->top > 0) ? Ri->d[0] : 0;\n        mont->n0[1] = 0;\n# endif\n    }\n#else\n    {\n        mont->ri = BN_num_bits(&mont->N);\n        BN_zero(R);\n        if (!BN_set_bit(R, mont->ri))\n            goto err;\n        if ((BN_mod_inverse(Ri, R, &mont->N, ctx)) == NULL)\n            goto err;\n        if (!BN_lshift(Ri, Ri, mont->ri))\n            goto err;\n        if (!BN_sub_word(Ri, 1))\n            goto err;\n        if (!BN_div(&(mont->Ni), NULL, Ri, &mont->N, ctx))\n            goto err;\n    }\n#endif\n    BN_zero(&(mont->RR));\n    if (!BN_set_bit(&(mont->RR), mont->ri * 2))\n        goto err;\n    if (!BN_mod(&(mont->RR), &(mont->RR), &(mont->N), ctx))\n        goto err;\n    ret = 1;\n err:\n    BN_CTX_end(ctx);\n    return ret;\n}', 'int BN_is_zero(const BIGNUM *a)\n{\n    return a->top == 0;\n}', 'void BN_CTX_start(BN_CTX *ctx)\n{\n    CTXDBG_ENTRY("BN_CTX_start", ctx);\n    if (ctx->err_stack || ctx->too_many)\n        ctx->err_stack++;\n    else if (!BN_STACK_push(&ctx->stack, ctx->used)) {\n        BNerr(BN_F_BN_CTX_START, BN_R_TOO_MANY_TEMPORARY_VARIABLES);\n        ctx->err_stack++;\n    }\n    CTXDBG_EXIT(ctx);\n}', 'BIGNUM *BN_CTX_get(BN_CTX *ctx)\n{\n    BIGNUM *ret;\n    CTXDBG_ENTRY("BN_CTX_get", ctx);\n    if (ctx->err_stack || ctx->too_many)\n        return NULL;\n    if ((ret = BN_POOL_get(&ctx->pool, ctx->flags)) == NULL) {\n        ctx->too_many = 1;\n        BNerr(BN_F_BN_CTX_GET, BN_R_TOO_MANY_TEMPORARY_VARIABLES);\n        return NULL;\n    }\n    BN_zero(ret);\n    ctx->used++;\n    CTXDBG_RET(ctx, ret);\n    return ret;\n}', 'void BN_CTX_end(BN_CTX *ctx)\n{\n    CTXDBG_ENTRY("BN_CTX_end", ctx);\n    if (ctx->err_stack)\n        ctx->err_stack--;\n    else {\n        unsigned int fp = BN_STACK_pop(&ctx->stack);\n        if (fp < ctx->used)\n            BN_POOL_release(&ctx->pool, ctx->used - fp);\n        ctx->used = fp;\n        ctx->too_many = 0;\n    }\n    CTXDBG_EXIT(ctx);\n}']