Can you just move all the delete[] uncompressed here outside of the switch? If uncompressed is null, delete is noop, so you're fine even in failure case.