In that scenario it's a goal, as the ball's in play once any other player touches it. (I think so at least, might be some kind of unsporting behaviour rule that prevents it)
It's more if a player takes the free kick to pass back to the keeper and it goes straight in. I think it's the same with...