Is it legal to free dogs locked in hot cars?

Is it legal to free dogs locked in hot cars?