main: don't use new (dynamic) allocations everytime

this might cause memory leaks.