make use of context_free function

In error case the context is freed without freeing its members.
Use the existing context_free function, which was unused until now
to free the context and its members.
Merge pull request #6 from mehlis/context_free

make use of context_free function