140,150d139 < secp256k1_context* secp256k1_context_create(unsigned int flags) { < size_t const prealloc_size = secp256k1_context_preallocated_size(flags); < secp256k1_context* ctx = (secp256k1_context*)checked_malloc(&default_error_callback, prealloc_size); < if (EXPECT(secp256k1_context_preallocated_create(ctx, flags) == NULL, 0)) { < free(ctx); < return NULL; < } < < return ctx; < } < 162,174d150 < secp256k1_context* secp256k1_context_clone(const secp256k1_context* ctx) { < secp256k1_context* ret; < size_t prealloc_size; < < VERIFY_CHECK(ctx != NULL); < ARG_CHECK(secp256k1_context_is_proper(ctx)); < < prealloc_size = secp256k1_context_preallocated_clone_size(ctx); < ret = (secp256k1_context*)checked_malloc(&ctx->error_callback, prealloc_size); < ret = secp256k1_context_preallocated_clone(ctx, ret); < return ret; < } < 186,197d161 < void secp256k1_context_destroy(secp256k1_context* ctx) { < ARG_CHECK_VOID(ctx == NULL || secp256k1_context_is_proper(ctx)); < < /* Defined as noop */ < if (ctx == NULL) { < return; < } < < secp256k1_context_preallocated_destroy(ctx); < free(ctx); < } < 220,229d183 < } < < secp256k1_scratch_space* secp256k1_scratch_space_create(const secp256k1_context* ctx, size_t max_size) { < VERIFY_CHECK(ctx != NULL); < return secp256k1_scratch_create(&ctx->error_callback, max_size); < } < < void secp256k1_scratch_space_destroy(const secp256k1_context *ctx, secp256k1_scratch_space* scratch) { < VERIFY_CHECK(ctx != NULL); < secp256k1_scratch_destroy(&ctx->error_callback, scratch);