The sample in the repository
contains undefined behaviour. This is caused by uninitialized
member variables of object
magma_dopts opts;, which is defined
in line 42. This can be detected with Valgrind.
A simple fix is to insert after line 42:
memset(&opts, 0, sizeof(magma_dopts));
to initialize the object correctly.