Hope this answers your question.
All the best,
You now have a definition of "double ending"; here's the issue: Dual Agency.
While "DA" is not illegal (in CA) the represented parties give up one important benefit by entering into such an agreement - advantageous advice. You can read more about this here:
In California it is legal as long as both parties are aware and it's disclosed in its entirety.
It does not always mean that an agent has a buyer or a "pocket" listing as mentioned below. There are times when I put a home in the MLS and a buyer calls me directly to represent them if they like the house.