hash: check malloc result
hash: bug fix -- missing value for ffi.string
hash: fix leaks