diff --git a/prover/core/prover.go b/prover/core/prover.go index c006e2dd23..8f8981394b 100644 --- a/prover/core/prover.go +++ b/prover/core/prover.go @@ -42,7 +42,6 @@ func NewProverCore(cfg *config.ProverCoreConfig) (*ProverCore, error) { var vk string var rawVK *C.char - defer C.free_c_chars(rawVK) if cfg.ProofType == message.ProofTypeBatch { C.init_batch_prover(paramsPathStr, assetsPathStr) rawVK = C.get_batch_vk() @@ -50,6 +49,7 @@ func NewProverCore(cfg *config.ProverCoreConfig) (*ProverCore, error) { C.init_chunk_prover(paramsPathStr, assetsPathStr) rawVK = C.get_chunk_vk() } + defer C.free_c_chars(rawVK) if rawVK != nil { vk = C.GoString(rawVK)