Fix a memory leak in SaveScreenshot()

Reference: Github bug #303