Add error checks for malloc calls that don't already have them. Issue #87.