Assets 2
Add checks for malloc failure and operation failures