added a free for corresponding malloc