Merge pull request #1610 from 0xc0dec/master

Correct array deallocation