mmottl / postgresql-ocaml

OCaml-bindings for the PostgreSQL database
Other
141 stars 23 forks source link

Change Field to Store_field #12

Closed Nevor closed 9 years ago

Nevor commented 9 years ago

The previous version of the code was using the Field macro after an allocation (caml_copy_string), in case of a bad timing, this could lead to a hard to debug memory corruption.

mmottl commented 9 years ago

Thanks, well spotted!

mmottl commented 9 years ago

I've also simplified the function to use the Store_field macro everywhere instead of using caml_modify + Field (same thing).

The new distribution is online.