• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Does param location l leak?

Status
Not open for further replies.
Level 15
Joined
Nov 30, 2007
Messages
1,202
Does this leak a location?

JASS:
method spawn takes player p, real x, real y, location l returns nothing 
            local integer i = 0
            local integer j
            local unit u
            loop
                set j = 0
                loop
                    set u = CreateUnit(p, .u[i].unitTypeId, x, y, 0)
                    call IssuePointOrderLoc(u, "attack", l)
                    set j = j + 1
                    exitwhen j >= .u[i].amount
                endloop
                set i = i + 1
                exitwhen i >= .index
            endloop
            set u = null
        endmethod

JASS:
private function OnFinish takes nothing returns boolean
        local unit u = GetTrainedUnit()
        local integer i = Squad.getIndex(GetUnitTypeId(u))
        local location l 
        if i > 0 then 
            set l = GetUnitRallyPoint(GetTriggerUnit())
            call squad[i].spawn(GetTriggerPlayer(), GetUnitX(u), GetUnitY(u), l)
            call RemoveLocation(l)
            set l = null
        endif
        set u = null
        return false
    endfunction
 
Status
Not open for further replies.
Top