addition of free(goodinput) into main function