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
Refactored context_free.

"Not NULL" checks are not needed as context memory is zero
initialized and free already checks whether the underlying
pointer is set to NULL.