file-xwd: sanity check colormap size (CVE-2013-1913)

(cherry picked from commit 32ae0f83e5748299641cceaabe3f80f1b3afd03e)
file-xwd: sanity check # of colors and map entries (CVE-2013-1978)

The number of colors in an image shouldn't be higher than the number of
colormap entries. Additionally, consolidate post error cleanup in
load_image().

(cherry picked from commit 23f685931e5f000dd033a45c60c1e60d7f78caf4)