It took me a while to find the problem as the code seems messy to me, but the actual root cause is quite simple:
Code:
//This is in the header
char pal57_init[3][769]={ ... }
//that's pal57_init[0], pal57_init[1] and pal57_init[2]
//This makes use of it
for (int i=5; i<8; i++)
{
memcpy(pcx_palette[i], pal57_init[i], 769);
}
//that's pal57_init[5], pal57_init[6] and pal57_init[7]
//which haven't been defined. The following would work:
for (int i=5; i<8; i++)
{
memcpy(pcx_palette[i], pal57_init[i-5], 769);
}