Skip to content

Commit

Permalink
safer backend release (#701)
Browse files Browse the repository at this point in the history
  • Loading branch information
dryajov authored Feb 10, 2024
1 parent 64e6a60 commit 6fab252
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions codex/slots/proofs/backends/circomcompat.nim
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,10 @@ proc prove*[H](
var
backend: ptr CircomCompatCtx

defer:
if backend != nil:
backend.addr.releaseCircomCompat()

if initCircomCompat(
self.backendCfg,
addr backend) != ERR_OK or backend == nil:
Expand Down Expand Up @@ -169,9 +173,6 @@ proc prove*[H](
if proofPtr != nil:
proofPtr.addr.releaseProof()

if backend != nil:
backend.addr.releaseCircomCompat()

success proof

proc verify*(
Expand Down

0 comments on commit 6fab252

Please sign in to comment.