3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-04-12 20:18:18 +00:00

Guard against null wrapped functions in OCaml API

This commit is contained in:
Nicola Mometto 2018-11-27 18:08:22 +00:00
parent 4686429318
commit ad49c3269a

View file

@ -1528,6 +1528,11 @@ def mk_z3native_stubs_c(ml_src_dir, ml_output_dir): # C interface
i = i + 1 i = i + 1
ml_wrapper.write(');\n') ml_wrapper.write(');\n')
if name in NULLWrapped:
ml_wrapper.write(' if (z3rv_m == NULL) {\n')
ml_wrapper.write(' caml_raise_with_string(*caml_named_value("Z3EXCEPTION"), "Object allocation failed");\n')
ml_wrapper.write(' }\n')
if release_caml_gc: if release_caml_gc:
ml_wrapper.write('\n caml_acquire_runtime_system();\n') ml_wrapper.write('\n caml_acquire_runtime_system();\n')