crypto/ec/ec_key.c:332: error: NULL_DEREFERENCE
  pointer `ctx` last assigned on line 287 could be null and is dereferenced by call to `BN_CTX_free()` at line 332, column 5.
Showing all 34 steps of the trace


crypto/ec/ec_key.c:270:1: start of procedure ec_key_simple_check_key()
268.   }
269.   
270. > int ec_key_simple_check_key(const EC_KEY *eckey)
271.   {
272.       int ok = 0;

crypto/ec/ec_key.c:272:5: 
270.   int ec_key_simple_check_key(const EC_KEY *eckey)
271.   {
272. >     int ok = 0;
273.       BN_CTX *ctx = NULL;
274.       const BIGNUM *order = NULL;

crypto/ec/ec_key.c:273:5: 
271.   {
272.       int ok = 0;
273. >     BN_CTX *ctx = NULL;
274.       const BIGNUM *order = NULL;
275.       EC_POINT *point = NULL;

crypto/ec/ec_key.c:274:5: 
272.       int ok = 0;
273.       BN_CTX *ctx = NULL;
274. >     const BIGNUM *order = NULL;
275.       EC_POINT *point = NULL;
276.   

crypto/ec/ec_key.c:275:5: 
273.       BN_CTX *ctx = NULL;
274.       const BIGNUM *order = NULL;
275. >     EC_POINT *point = NULL;
276.   
277.       if (eckey == NULL || eckey->group == NULL || eckey->pub_key == NULL) {

crypto/ec/ec_key.c:277:9: Taking false branch
275.       EC_POINT *point = NULL;
276.   
277.       if (eckey == NULL || eckey->group == NULL || eckey->pub_key == NULL) {
               ^
278.           ECerr(EC_F_EC_KEY_SIMPLE_CHECK_KEY, ERR_R_PASSED_NULL_PARAMETER);
279.           return 0;

crypto/ec/ec_key.c:277:26: Taking false branch
275.       EC_POINT *point = NULL;
276.   
277.       if (eckey == NULL || eckey->group == NULL || eckey->pub_key == NULL) {
                                ^
278.           ECerr(EC_F_EC_KEY_SIMPLE_CHECK_KEY, ERR_R_PASSED_NULL_PARAMETER);
279.           return 0;

crypto/ec/ec_key.c:277:50: Taking false branch
275.       EC_POINT *point = NULL;
276.   
277.       if (eckey == NULL || eckey->group == NULL || eckey->pub_key == NULL) {
                                                        ^
278.           ECerr(EC_F_EC_KEY_SIMPLE_CHECK_KEY, ERR_R_PASSED_NULL_PARAMETER);
279.           return 0;

crypto/ec/ec_key.c:282:9: 
280.       }
281.   
282. >     if (EC_POINT_is_at_infinity(eckey->group, eckey->pub_key)) {
283.           ECerr(EC_F_EC_KEY_SIMPLE_CHECK_KEY, EC_R_POINT_AT_INFINITY);
284.           goto err;

crypto/ec/ec_lib.c:824:1: start of procedure EC_POINT_is_at_infinity()
  822.   }
  823.   
  824. > int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *point)
  825.   {
  826.       if (group->meth->is_at_infinity == 0) {

crypto/ec/ec_lib.c:826:9: Taking false branch
  824.   int EC_POINT_is_at_infinity(const EC_GROUP *group, const EC_POINT *point)
  825.   {
  826.       if (group->meth->is_at_infinity == 0) {
                 ^
  827.           ECerr(EC_F_EC_POINT_IS_AT_INFINITY,
  828.                 ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);

crypto/ec/ec_lib.c:831:9: Taking true branch
  829.           return 0;
  830.       }
  831.       if (group->meth != point->meth) {
                 ^
  832.           ECerr(EC_F_EC_POINT_IS_AT_INFINITY, EC_R_INCOMPATIBLE_OBJECTS);
  833.           return 0;

crypto/ec/ec_lib.c:832:9: Skipping ERR_put_error(): empty list of specs
  830.       }
  831.       if (group->meth != point->meth) {
  832.           ECerr(EC_F_EC_POINT_IS_AT_INFINITY, EC_R_INCOMPATIBLE_OBJECTS);
                 ^
  833.           return 0;
  834.       }

crypto/ec/ec_lib.c:833:9: 
  831.       if (group->meth != point->meth) {
  832.           ECerr(EC_F_EC_POINT_IS_AT_INFINITY, EC_R_INCOMPATIBLE_OBJECTS);
  833. >         return 0;
  834.       }
  835.       return group->meth->is_at_infinity(group, point);

crypto/ec/ec_lib.c:836:1: return from a call to EC_POINT_is_at_infinity
  834.       }
  835.       return group->meth->is_at_infinity(group, point);
  836. > }
  837.   
  838.   /*

crypto/ec/ec_key.c:282:9: Taking false branch
280.       }
281.   
282.       if (EC_POINT_is_at_infinity(eckey->group, eckey->pub_key)) {
               ^
283.           ECerr(EC_F_EC_KEY_SIMPLE_CHECK_KEY, EC_R_POINT_AT_INFINITY);
284.           goto err;

crypto/ec/ec_key.c:287:9: Taking true branch
285.       }
286.   
287.       if ((ctx = BN_CTX_new()) == NULL)
               ^
288.           goto err;
289.       if ((point = EC_POINT_new(eckey->group)) == NULL)

crypto/ec/ec_key.c:331:2: 
329.       }
330.       ok = 1;
331. >  err:
332.       BN_CTX_free(ctx);
333.       EC_POINT_free(point);

crypto/ec/ec_key.c:332:5: 
330.       ok = 1;
331.    err:
332. >     BN_CTX_free(ctx);
333.       EC_POINT_free(point);
334.       return ok;

crypto/bn/bn_ctx.c:157:1: start of procedure BN_CTX_free()
  155.   }
  156.   
  157. > void BN_CTX_free(BN_CTX *ctx)
  158.   {
  159.   #ifdef BN_CTX_DEBUG

crypto/bn/bn_ctx.c:174:5: 
  172.       }
  173.   #endif
  174. >     BN_STACK_finish(&ctx->stack);
  175.       BN_POOL_finish(&ctx->pool);
  176.       OPENSSL_free(ctx);

crypto/bn/bn_ctx.c:243:1: start of procedure BN_STACK_finish()
    241.   }
    242.   
    243. > static void BN_STACK_finish(BN_STACK *st)
    244.   {
    245.       OPENSSL_free(st->indexes);

crypto/bn/bn_ctx.c:245:5: 
    243.   static void BN_STACK_finish(BN_STACK *st)
    244.   {
    245. >     OPENSSL_free(st->indexes);
    246.       st->indexes = NULL;
    247.   }

crypto/mem.c:295:1: start of procedure CRYPTO_free()
      293.   }
      294.   
      295. > void CRYPTO_free(void *str, const char *file, int line)
      296.   {
      297.       INCREMENT(free_count);

crypto/mem.c:298:9: Taking true branch
      296.   {
      297.       INCREMENT(free_count);
      298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                     ^
      299.           free_impl(str, file, line);
      300.           return;

crypto/mem.c:298:30: Taking true branch
      296.   {
      297.       INCREMENT(free_count);
      298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                          ^
      299.           free_impl(str, file, line);
      300.           return;

crypto/mem.c:299:9: Skipping __function_pointer__(): unresolved function pointer
      297.       INCREMENT(free_count);
      298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
      299.           free_impl(str, file, line);
                     ^
      300.           return;
      301.       }

crypto/mem.c:300:9: 
      298.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
      299.           free_impl(str, file, line);
      300. >         return;
      301.       }
      302.   

crypto/mem.c:314:1: return from a call to CRYPTO_free
      312.       free(str);
      313.   #endif
      314. > }
      315.   
      316.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/bn/bn_ctx.c:246:5: 
    244.   {
    245.       OPENSSL_free(st->indexes);
    246. >     st->indexes = NULL;
    247.   }
    248.   

crypto/bn/bn_ctx.c:247:1: return from a call to BN_STACK_finish
    245.       OPENSSL_free(st->indexes);
    246.       st->indexes = NULL;
    247. > }
    248.   
    249.   

crypto/bn/bn_ctx.c:175:5: 
  173.   #endif
  174.       BN_STACK_finish(&ctx->stack);
  175. >     BN_POOL_finish(&ctx->pool);
  176.       OPENSSL_free(ctx);
  177.   }

crypto/bn/bn_ctx.c:284:1: start of procedure BN_POOL_finish()
    282.   }
    283.   
    284. > static void BN_POOL_finish(BN_POOL *p)
    285.   {
    286.       unsigned int loop;

crypto/bn/bn_ctx.c:289:12: Loop condition is false. Leaving loop
    287.       BIGNUM *bn;
    288.   
    289.       while (p->head) {
                      ^
    290.           for (loop = 0, bn = p->head->vals; loop++ < BN_CTX_POOL_SIZE; bn++)
    291.               if (bn->d)
