I have written some code that adds new functionalities to a Julia library that wraps a C library. The code executes fine, in that it generates outcomes as expected, but on exit of Julia it leads to a segmentation fault with the following message (on OS X):