avcodec/xpmdec: Fix multiple pointer/memory issues