Check error code immediately after creating image

Change-Id: I93c9124569a3d40413d839b1a01abad7342c08df
Merge "Check error code immediately after creating image"