fix a context object reference leak from upgrading a paletted image