Coconut milk will curdle if you heat it up too much and too fast. Control your heat to avoid curdling. Also, adding acidity such as lime or lemon juice when the curry is boiling can curdle it as well. It doesn't look that great as when you have uncurdled curry, but it still tastes the same way, so theoretically there is nothing wrong with your curry if you spot some curdles.