Simple combinatorial PAL/GAL reader

Wat do youconsider weird?

Further, the use of malloc() throws a warning; invalid conversion from 'void' to 'char*' [-fpermissive]*. You will need to cast to a char pointer.
And I don't see a need for malloc(); you just as well can use

char padded[5];

Lastly, why the use of exit(0)? It might be better to use

for(;;);

If you want to stop loop(). Or just move the code that you have in loop() to setup(); in that case it will be executed only once.