Why memory allocated through malloc should be freed ?

Except at runtime because the process can consume all 4Gb (32-bit process) such that it ultimately freezes and cannot continue. On machines with little RAM this is a serious problem as it can prevent other processes from starting or allocating memory. When the leaking process terminates all memory allocated from text data and stack segments is released.