variables: fix a segfault and memory leak when TriggerCallback is called (crash