fixed: safe_malloc did not return