Mismatching allocation-deallocation

Uses delete[] instead of free() to remove cppcheck error regarding mismatching allocation-deallocation.