Fix four unchecked memory allocations