This line and the SAFE_DELETE_ARRAY would not be needed if you first create the image without setting the data.
Then pass the image buffer pointer to the glReadPixel data param. It would then directly copy the data to the image buffer.
This would result in 1 less copy and delete.