calls `delete[]` instead of `delete`

calls `delete[]` instead of `delete`
Merge pull request #4181 from ricardoquesada/delete_fixes

calls `delete[]` instead of `delete`