iden3 / circom

zkSnark circuit compiler
GNU General Public License v3.0
1.33k stars 262 forks source link

fix generate_function_release_memory_component function #142

Closed eduadiez closed 1 year ago

eduadiez commented 1 year ago

The code generated for C++ when using parallel components produces a core dump:

./final ~/zkevm-prover/final_proof.zkin.json final.wtns
munmap_chunk(): invalid pointer
Aborted (core dumped)

This is due to how memory is freed, I have converted the deletes to array, added a check to avoid freeing if they have not been allocated, and also the initialisation of the pointers to null, this seems to fix the problem

alrubio commented 1 year ago

Thanks for the contribution.