What are those safe ways?

In the US anyway there are places you can drop off a child "no questions asked". Often fire departments or (I think?) police stations. It's to prevent this exact thing.