Release fonts on closing main window

Plug the leak by freeing the fonts in the destructor when destroying the main window.
Then the font structure is freed during closing the last window.

The change is discovered and tested in valgrind.
Avoid casting away const qualifier in byteorder detection code

Killed warning: "cast from type 'const char*’ to type 'u_int32_t*'"
The code return 1 if little endian and 0 if big or middle endian.
Include <stdlib.h> to find free() in libmpeg3 code

Killed warning: "incompatible implicit declaration of built-in function 'free'".