crypto/ec/ec_mult.c:317: error: NULL_DEREFERENCE
  pointer `ctx` last assigned on line 142 could be null and is dereferenced by call to `BN_CTX_end()` at line 317, column 5.
Showing all 23 steps of the trace


crypto/ec/ec_mult.c:131:1: start of procedure ec_mul_consttime()
129.    * Returns 1 on success, 0 otherwise.
130.    */
131. > static int ec_mul_consttime(const EC_GROUP *group, EC_POINT *r,
132.                               const BIGNUM *scalar, const EC_POINT *point,
133.                               BN_CTX *ctx)

crypto/ec/ec_mult.c:136:5: 
134.   {
135.       int i, order_bits, group_top, kbit, pbit, Z_is_one;
136. >     EC_POINT *s = NULL;
137.       BIGNUM *k = NULL;
138.       BIGNUM *lambda = NULL;

crypto/ec/ec_mult.c:137:5: 
135.       int i, order_bits, group_top, kbit, pbit, Z_is_one;
136.       EC_POINT *s = NULL;
137. >     BIGNUM *k = NULL;
138.       BIGNUM *lambda = NULL;
139.       BN_CTX *new_ctx = NULL;

crypto/ec/ec_mult.c:138:5: 
136.       EC_POINT *s = NULL;
137.       BIGNUM *k = NULL;
138. >     BIGNUM *lambda = NULL;
139.       BN_CTX *new_ctx = NULL;
140.       int ret = 0;

crypto/ec/ec_mult.c:139:5: 
137.       BIGNUM *k = NULL;
138.       BIGNUM *lambda = NULL;
139. >     BN_CTX *new_ctx = NULL;
140.       int ret = 0;
141.   

crypto/ec/ec_mult.c:140:5: 
138.       BIGNUM *lambda = NULL;
139.       BN_CTX *new_ctx = NULL;
140. >     int ret = 0;
141.   
142.       if (ctx == NULL && (ctx = new_ctx = BN_CTX_secure_new()) == NULL)

crypto/ec/ec_mult.c:142:9: Taking true branch
140.       int ret = 0;
141.   
142.       if (ctx == NULL && (ctx = new_ctx = BN_CTX_secure_new()) == NULL)
               ^
143.           goto err;
144.   

crypto/ec/ec_mult.c:142:24: 
140.       int ret = 0;
141.   
142. >     if (ctx == NULL && (ctx = new_ctx = BN_CTX_secure_new()) == NULL)
143.           goto err;
144.   

crypto/bn/bn_ctx.c:148:1: start of procedure BN_CTX_secure_new()
  146.   }
  147.   
  148. > BN_CTX *BN_CTX_secure_new(void)
  149.   {
  150.       BN_CTX *ret = BN_CTX_new();

crypto/bn/bn_ctx.c:150:5: Skipping BN_CTX_new(): empty list of specs
  148.   BN_CTX *BN_CTX_secure_new(void)
  149.   {
  150.       BN_CTX *ret = BN_CTX_new();
             ^
  151.   
  152.       if (ret != NULL)

crypto/bn/bn_ctx.c:152:9: Taking false branch
  150.       BN_CTX *ret = BN_CTX_new();
  151.   
  152.       if (ret != NULL)
                 ^
  153.           ret->flags = BN_FLG_SECURE;
  154.       return ret;

crypto/bn/bn_ctx.c:154:5: 
  152.       if (ret != NULL)
  153.           ret->flags = BN_FLG_SECURE;
  154. >     return ret;
  155.   }
  156.   

crypto/bn/bn_ctx.c:155:1: return from a call to BN_CTX_secure_new
  153.           ret->flags = BN_FLG_SECURE;
  154.       return ret;
  155. > }
  156.   
  157.   void BN_CTX_free(BN_CTX *ctx)

crypto/ec/ec_mult.c:142:24: Taking true branch
140.       int ret = 0;
141.   
142.       if (ctx == NULL && (ctx = new_ctx = BN_CTX_secure_new()) == NULL)
                              ^
143.           goto err;
144.   

crypto/ec/ec_mult.c:315:2: 
313.       ret = 1;
314.   
315. >  err:
316.       EC_POINT_free(s);
317.       BN_CTX_end(ctx);

crypto/ec/ec_mult.c:316:5: 
314.   
315.    err:
316. >     EC_POINT_free(s);
317.       BN_CTX_end(ctx);
318.       BN_CTX_free(new_ctx);

crypto/ec/ec_lib.c:582:1: start of procedure EC_POINT_free()
  580.   }
  581.   
  582. > void EC_POINT_free(EC_POINT *point)
  583.   {
  584.       if (!point)

crypto/ec/ec_lib.c:584:10: Taking true branch
  582.   void EC_POINT_free(EC_POINT *point)
  583.   {
  584.       if (!point)
                  ^
  585.           return;
  586.   

crypto/ec/ec_lib.c:585:9: 
  583.   {
  584.       if (!point)
  585. >         return;
  586.   
  587.       if (point->meth->point_finish != 0)

crypto/ec/ec_lib.c:590:1: return from a call to EC_POINT_free
  588.           point->meth->point_finish(point);
  589.       OPENSSL_free(point);
  590. > }
  591.   
  592.   void EC_POINT_clear_free(EC_POINT *point)

crypto/ec/ec_mult.c:317:5: 
315.    err:
316.       EC_POINT_free(s);
317. >     BN_CTX_end(ctx);
318.       BN_CTX_free(new_ctx);
319.   

crypto/bn/bn_ctx.c:195:1: start of procedure BN_CTX_end()
  193.   }
  194.   
  195. > void BN_CTX_end(BN_CTX *ctx)
  196.   {
  197.       CTXDBG_ENTRY("BN_CTX_end", ctx);

crypto/bn/bn_ctx.c:198:9: Taking true branch
  196.   {
  197.       CTXDBG_ENTRY("BN_CTX_end", ctx);
  198.       if (ctx->err_stack)
                 ^
  199.           ctx->err_stack--;
  200.       else {
