Use the correct version of delete within a unit test

This fixes valgrind warnings when running this test. The mismatched
delete could also potentially have caused memory corruption issues
while running the tests.
Merge pull request #1360 from mstorsjo/use-correct-delete

Use the correct version of delete within a unit test