Access Violation in freeArray

Sending array with ref causes an access violation