Yes, most people don't recomend leaning any objects inside the tank against the glass... I suppose it is ok if the rocks are small, but there's also danger of scratching them as well...
Personally, I'd rather not lean them against the glass - leave a small gap as Aquascaper suggested.