Set MemoryError when appropriate, add missing failure checks, and fix some potential leaks.
Attach a file by drag & drop or click to upload