Eliminate unnessesary malloc.
Fix stack smashing (BUFSIZE)