xcf: fix #6138 Stack Overflow when saving xcf.
Although I haven't been able to reproduce it, it is apparently possible to get a Stack Overflow when loading xcf files with presumably very large dimensions on Windows. From what I'm reading Windows normally has a smaller stack size than Linux, probably why it hasn't surfaced there. Instead of allocating on the stack let's do a g_malloc0 combined with g_free.
Showing with 7 additions and 2 deletions