Corrected problems reported by scan-build

Additionally, added ASS_WARN_UNUSED macro and checked some more mallocs.