Adding a check for allocation failure was a good idea, it just needs checking the right variable...
Attach a file by drag & drop or click to upload