Adjustment to main.c and generator.c

In main.c, I add the operation to allocate memory for Pool  and free it
in the end.

In generator.c, I tuning for the amout of memories that need to assign
to each temporary derectories, and free them in the end.

Everything works alright. So far so good for now.