Fix malloc-ed memory freed by delete[]
Merge pull request #1356 from manisandro/malloc_delete

Fix malloc-ed memory freed by delete[]