Fixed #5247 (FP: Memory is allocated but not initialized for FILE*)
Library: Refactoring of markup code