fix segfault and compilation error on OSX10.9 and FreeBSD 10 with clang
add deallocation, doh
make sure to free context in all paths
Merge pull request #3 from erkmos/osxfix

Segfault and compilation error on OSX10.9 and FreeBSD 10 with clang