change NIF resource handling to avoid leaks
change NIF resource handling to avoid leaks

NIF resources could leak if a caller invoked one of the sha*_init
functions without ever passing it to the corresponding sha*_final
function. Resources are now freed immediately after creating resource
terms that are returned to callers. Also, add a Context destructor to
free the contained binary if it's never been returned to the caller.

vinoski/erlsha2,vinoski/erlsha2