Copyright heartbeat
Check env was allocated before attempting to free