leaks arise when you do not assign a variable to store the data you just generated. for example, the following action would cause a leak:
create 1 footman at (random point in spawn1)
in this action, memory is allocated but the game loses its handle on the memory immediately afterward, thus creating a memory leak. however, the following actions take care of that:
set point1 = (random point in spawn1)
create 1 footman at (point1)
in this action no new memory is allocated; instead, the location is stored in point1 and the handle on the memory is not lost. the next time the action executes, it will create a point that replaces the data in point1 without allocating any new memory.
for your particular memory leak i would suggest the following actions:
set group1 = (units of type Need More Soul Shards (2))
set num1 = (number of units in (group1))
if (num1 equal to 0)
//actions
in this way you are using the same memory locations every time you run the trigger, thus preventing a memory leak.