The target memory manager, introduced to libomptarget with rG0289696751e9a959b2413ca26624fc6c91be1eea, will try to free target memory it allocated, using __tgt_rtl_data_delete(), when the host program shuts down.
This is a problem for the VE plugin because it cleans up all its target resources when its destructor is called, which happens before the Memory Manager destructor frees is executed. This means that there is no VE process handle when the Memory Manager tries to free its allocated target memory and the call to veo_free_mem() causes a program crash.
This patch adds a workaround for this problem. It simply makes __tgt_rtl_data_delete() return OFFLOAD_SUCCESS immediately if the plugin has already cleaned up its target memory.