[[ Bug 13804 ]] Crash freeing invalid palette struct
Merge pull request #1365 from runrevali/bugfix-13804

[[ Bug 13804 ]] Crash freeing invalid palette struct